Excelで超シンプルなはがき印刷ソフトを作ってみよう

Step 7 宛先の横棒を縦棒に変更する



Homeに戻る > Excelでアプリケーションソフト > はがき印刷ソフト

シートのVBAコード

下記のコードに変更してください

'データのセット
Private Sub ExPrintDataSet(drow As Long)
    Dim i As Integer
    Dim n As Integer
    Dim dat As String
    Dim s As String
    
    '宛先郵便番号
    n = 1
    dat = ActiveSheet.Cells(drow, 3)
    For i = 1 To 8
        s = Mid(dat, i, 1)
        If s <> "-" And s <> "-" Then
            Sheets("はがき表").Shapes("〒" & n).TextFrame.Characters.Text = s
            n = n + 1
        End If
    Next
    
    '住所1、住所2
    dat = ActiveSheet.Cells(drow, 4)
    s = ActiveSheet.Cells(drow, 5)
    If s <> "" Then
        dat = dat & vbCrLf & s
    End If
    dat = Replace(dat, "-", "│")
    dat = Replace(dat, "-", "│")
    Sheets("はがき表").Shapes("宛先住所").TextFrame.Characters.Text = dat
    
    '名前
    dat = ActiveSheet.Cells(drow, 6) & " " & ActiveSheet.Cells(drow, 7)
    Sheets("はがき表").Shapes("宛先名前").TextFrame.Characters.Text = dat
End Sub



実行結果

番地の - が | に変更されている


Homeに戻る > Excelでアプリケーションソフト > はがき印刷ソフト

■■■
このサイトの内容を利用して発生した、いかなる問題にも一切責任は負いませんのでご了承下さい
■■■
当ホームページに掲載されているあらゆる内容の無許可転載・転用を禁止します


Copyright (c) Excel-Excel ! All rights reserved