jbakerstull
asked on
Access Alphabetical Characters Keypress
Working on function that only allows characters & backspace keystrokes in text box.
I'm calling function on keypress event
KeyAscii = CLimitTextInput(KeyAscii) 'Calling CLimitTextInput function.
When I test function, I do receive the error message if a numeric value is pressed, but when I type a character it does not appear in text box.
I'm calling function on keypress event
KeyAscii = CLimitTextInput(KeyAscii) 'Calling CLimitTextInput function.
When I test function, I do receive the error message if a numeric value is pressed, but when I type a character it does not appear in text box.
Function CLimitTextInput(KeyAscii) As Integer
Select Case KeyAscii
' 65 To 90 and 97 To 122: These are all alphas, upper and lowercase
' 8 Backspace, 9 Tab Key, 32 Space Key
Case 65 To 90, 97 To 122, 8, 9, 32
Case Else
'Setting KeyAscii to zero cancels the key input
KeyAscii = 0
MsgBox ("Only Alphabetical Characters Allowed")
Exit Function
End Select
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER