MrExcel Publishing
Your One Stop for Excel Tips & Solutions

OnKey - Key values


Posted by Richie on July 29, 2001 9:16 AM

There was recently a post by Dax regarding the OnKey command, the code for which is shown below.

The code gives the keyboard values for the letters A to Z as being 97 to 122. Is there anywhere that provides details of all of the keyboard values, or does somebody have a list that they could post?

Sub DisableShortCutKeys()
'Disable Ctrl-a to Ctrl-z
Dim x As Integer
For x = 97 To 122
Application.OnKey "^" & Chr(x), ""
Next x
End Sub

Sub EnableShortCutKeys()
Dim x As Integer
For x = 97 To 122
Application.OnKey "^" & Chr(x)
Next x
End Sub


Posted by Ivan F Moala on July 29, 2001 5:58 PM

Lookup online help for [Character Set] OR Chr OR
ASCII which is what the routine is doing, converting ASCII numbers to the character set.

Ivan