OnKey - Key values


Posted by Richie on July 31, 2001 11:29 AM

Sorry if you've read this before - I think the original got lost in the missing posts for the end of July.

Anyway here goes again. A previous post from Dax, regarding the OnKey command, used key values for the letters A to Z of Chr (97) to (122) - the code is reproduced below. Does anybody know where to find a list of all of the keyboard values? Is there a macro that will produce such a list?

Thanks in anticipation, Richie.

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 Jerid on July 31, 2001 11:43 AM

Open your Excel file, open your code, put your cursor on the word OnKey and press F1 for context sensitive help to get the list.

Jerid

Posted by Richie on July 31, 2001 12:01 PM

Thanks Jerid, but I don't think I explained myself very well (I had already looked at the Help info).

I'd like to know the numeric values for the other keys (like 97 to 122 for a to z) so that the values may be used in a similar way to Dax's routine (ie a simple For..Next), rather than having to list out each individual key.

Posted by Jerid on July 31, 2001 1:09 PM


These??

0 · 32 [space] 64 @ 96 `
1 · 33 ! 65 A 97 a
2 · 34 " 66 B 98 b
3 · 35 # 67 C 99 c
4 · 36 $ 68 D 100 d
5 · 37 % 69 E 101 e
6 · 38 & 70 F 102 f
7 · 39 ' 71 G 103 g
8 * * 40 ( 72 H 104 h
9 * * 41 ) 73 I 105 i
10 * * 42 * 74 J 106 j
11 · 43 + 75 K 107 k
12 · 44 , 76 L 108 l
13 * * 45 - 77 M 109 m
14 · 46 . 78 N 110 n
15 · 47 / 79 O 111 o
16 · 48 0 80 P 112 p
17 · 49 1 81 Q 113 q
18 · 50 2 82 R 114 r
19 · 51 3 83 S 115 s
20 · 52 4 84 T 116 t
21 · 53 5 85 U 117 u
22 · 54 6 86 V 118 v
23 · 55 7 87 W 119 w
24 · 56 8 88 X 120 x
25 · 57 9 89 Y 121 y
26 · 58 : 90 Z 122 z
27 · 59 ; 91 [ 123 {
28 · 60 < 92 \ 124 |
29 · 61 = 93 ] 125 }
30 · 62 > 94 ^ 126 ~
31 · 63 ? 95 _ 127 ·
· These characters aren't supported by Microsoft Windows.
* * Values 8, 9, 10, and 13 convert to backspace, tab, linefeed, and carriage return characters, respectively. They have no graphical representation but, depending on the application, can affect the visual display of text.


128 · 160 [space] 192 À 224 à
129 · 161 ¡ 193 Á 225 á
130 · 162 ¢ 194 Â 226 â
131 · 163 £ 195 Ã 227 ã
132 · 164 ¤ 196 Ä 228 ä
133 · 165 ¥ 197 Å 229 å
134 · 166 ¦ 198 Æ 230 æ
135 · 167 § 199 Ç 231 ç
136 · 168 ¨ 200 È 232 è
137 · 169 © 201 É 233 é
138 · 170 ª 202 Ê 234 ê
139 · 171 « 203 Ë 235 ë
140 · 172 ¬ 204 Ì 236 ì
141 · 173 ­ 205 Í 237 í
142 · 174 ® 206 Î 238 î
143 · 175 ¯ 207 Ï 239 ï
144 · 176 ° 208 Ð 240 ð
145 ‘ 177 ± 209 Ñ 241 ñ
146 ’ 178 ² 210 Ò 242 ò
147 · 179 ³ 211 Ó 243 ó
148 · 180 ´ 212 Ô 244 ô
149 · 181 µ 213 Õ 245 õ
150 · 182 ¶ 214 Ö 246 ö
151 · 183 · 215 × 247 ÷
152 · 184 ¸ 216 Ø 248 ø
153 · 185 ¹ 217 Ù 249 ù
154 · 186 º 218 Ú 250 ú
155 · 187 » 219 Û 251 û
156 · 188 ¼ 220 Ü 252 ü
157 · 189 ½ 221 Ý 253 ý
158 · 190 ¾ 222 Þ 254 þ
159 · 191 ¿ 223 ß 255 ÿ
· These characters aren't supported by Microsoft Windows.

Search the help for ASCII Character Set

Jerid



Posted by Richie on August 01, 2001 5:46 AM

Thanks Jerid - yes those were what I wanted