| 
    
     |  | 例えば、TextBox1のAfterUpdateイベントで行うとすれば以下の様に成ります 
 Private Sub TextBox1_AfterUpdate()
 
 Dim i As Long
 Dim strBuff As String
 Dim strData As String
 Dim strResult As String
 
 strData = TextBox1.Text
 If strData <> "" Then
 For i = 1 To Len(strData)
 strBuff = JIS8(Mid(strData, i, 1))
 If strBuff <> "" Then
 strResult = strResult & strBuff
 Else
 Beep
 MsgBox "変換できない文字が含まれています 「" _
 & Mid(strData, i, 1) & "」"
 Exit Sub
 End If
 Next i
 TextBox2.Text = strResult
 End If
 
 End Sub
 
 後、以下のコードを「Sub JIS8」に追加して下さい
 
 Public Function JIS8(ByVal strValue As String) As String
 
 Dim lngASCNo As Long
 
 If strValue = "" Then '※追加
 Exit Function '※追加
 End If '※追加
 
 lngASCNo = Asc(Left(strValue, 1))
 
 |  |