const validchars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
If Instr(validchars, KeyPressed) > 0 Then
'its valid
else
'its not valid
end if
Instr is the InString command and looks for instances of the second parameter in the first paramater and returns the position in the string so if its greater than 0 then it exists in the string
Command:
Instr(The comparison string, the string to search for)