Ignore Specific Characters In TextBox

'Add 1 TextBox To Your Form.
'Insert the following code to your form:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim sTemplate As String
'Replace the '!@#$%^&*()_+=' with the characters you want to ignore
sTemplate = "!@#$%^&*()_+="
If InStr(1, sTemplate, Chr(KeyAscii)) > 0 Then KeyAscii = 0
End Sub

Go Back