Convert String to KeyCode

  • Thread starter Thread starter KC1960
  • Start date Start date
KC1960,

Can you elaborate a little more? A "string" can be of any length and can
contain many characters.

Please try to explain exactly what are you really wanting to do?

Mr B
askdoctoraccess dot com
 
Is there a way to convert a string to keycode?

For keys that correspond to ASCII characters, you can use the Asc() function:
e.g. Asc("A") is 65, and 65 is also the value of vbKeyA.

It gets harder when you try to use non-ASCII characters, or lower case
characters, or characters which could be rendered by different keys - e.g. the
numeric keypad 3 has a different keycode than the typewriter keyboard 3 :

?vbkey3
51
?vbkeynumpad3
99

You can use the Object Browser to look at the KeyCodeConstants collection if
this is something you want to deal with.
 
Back
Top