On Mon, 4 Jan 2010 16:15:01 -0800, David C <David
Is it possible to restrict the user from entering special characters in a
"regular text" form field? I want to restrict symbols and special characters
such as" !@#$%^&*
It isn't possible to prevent entry of those characters. What you can
do is check the entry as the cursor exits from the field, and send the
cursor back into the field if any of those characters are present.
Adapt the macros in
http://www.gmayor.com/formfieldmacros.htm (and see
http://www.gmayor.com/installing_macro.htm if needed) by replacing the
AOnExit() macro with
Public Sub AOnExit()
Dim ch As String
Dim i As Long
With GetCurrentFF
For i = 1 To Len(.Result)
If Not Mid$(.Result, i, 1) Like "[A-Za-z0-9 .,]" Then
MsgBox "Enter only letters and numbers"
mstrFF = GetCurrentFF.Name
Exit For
End If
Next i
End With
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
.