Private Sub txtField_Validate(Cancel As Boolean) If txtField.Text <> "a" Then MsgBox ("入力文字が違います") Cancel = True End If End Sub