KEYASCII

USUARIO.EXCLUIDOS 18/04/2007 14:30:20
#212557
Pessoal estou precisando usar teclas de atalho, por exemplo se apertar f9, o aplicativo fecha, imagino que seja do jeito abaixo:

If KeyAscii = 120 Then
end
End If

Porem, não sei, se é assim, assim não esta dando certo, talves porque estou colocando em objeto e evento errado. Pessoal por favor explica ai o código, objeto e evento.

Obrigado.

ERINALDO 18/04/2007 14:48:30
#212562
voce pode usar:
If vbKeyF9 then 'F9
end
else
end if
--------------------------------------------------------------------------------
Olá, segue a lista :

Key Codes

Constant Value Description
vbKeyLButton 1 Left mouse button
vbKeyRButton 2 Right mouse button
vbKeyCancel 3 CANCEL key
vbKeyMButton 4 Middle mouse button
vbKeyBack 8 BACKSPACE key
vbKeyTab 9 TAB key
vbKeyClear 12 CLEAR key
vbKeyReturn 13 ENTER key
vbKeyShift 16 SHIFT key
vbKeyControl 17 CTRL key
vbKeyMenu 18 MENU key
vbKeyPause 19 PAUSE key
vbKeyCapital 20 CAPS LOCK key
vbKeyEscape 27 ESC key
vbKeySpace 32 SPACEBAR key
vbKeyPageUp 33 PAGE UP key
vbKeyPageDown 34 PAGE DOWN key
vbKeyEnd 35 END key
vbKeyHome 36 HOME key
vbKeyLeft 37 LEFT ARROW key
vbKeyUp 38 UP ARROW key
vbKeyRight 39 RIGHT ARROW key
vbKeyDown 40 DOWN ARROW key
vbKeySelect 41 SELECT key
vbKeyPrint 42 PRINT SCREEN key
vbKeyExecute 43 EXECUTE key
vbKeySnapshot 44 SNAPSHOT key
vbKeyInsert 45 INS key
vbKeyDelete 46 DEL key
vbKeyHelp 47 HELP key
vbKeyNumlock 144 NUM LOCK key
KeyA Through KeyZ Are the Same as Their ASCII Equivalents: 'A' Through 'Z'

Constant Value Description
vbKeyA 65 A key
vbKeyB 66 B key
vbKeyC 67 C key
vbKeyD 68 D key
vbKeyE 69 E key
vbKeyF 70 F key
vbKeyG 71 G key
vbKeyH 72 H key
vbKeyI 73 I key
vbKeyJ 74 J key
vbKeyK 75 K key
vbKeyL 76 L key
vbKeyM 77 M key
vbKeyN 78 N key
vbKeyO 79 O key
vbKeyP 80 P key
vbKeyQ 81 Q key
vbKeyR 82 R key
vbKeyS 83 S key
vbKeyT 84 T key
vbKeyU 85 U key
vbKeyV 86 V key
vbKeyW 87 W key
vbKeyX 88 X key
vbKeyY 89 Y key
vbKeyZ 90 Z key
Key0 Through Key9 Are the Same as Their ASCII Equivalents: '0' Through '9

Constant Value Description
vbKey0 48 0 key
vbKey1 49 1 key
vbKey2 50 2 key
vbKey3 51 3 key
vbKey4 52 4 key
vbKey5 53 5 key
vbKey6 54 6 key
vbKey7 55 7 key
vbKey8 56 8 key
vbKey9 57 9 key
Keys on the Numeric Keypad

Constant Value Description
vbKeyNumpad0 96 0 key
vbKeyNumpad1 97 1 key
vbKeyNumpad2 98 2 key
vbKeyNumpad3 99 3 key
vbKeyNumpad4 100 4 key
vbKeyNumpad5 101 5 key
vbKeyNumpad6 102 6 key
vbKeyNumpad7 103 7 key
vbKeyNumpad8 104 8 key
vbKeyNumpad9 105 9 key
vbKeyMultiply 106 MULTIPLICATION SIGN (*) key
vbKeyAdd 107 PLUS SIGN (+) key
vbKeySeparator 108 ENTER (keypad) key
vbKeySubtract 109 MINUS SIGN (-) key
vbKeyDecimal 110 DECIMAL POINT(.) key
vbKeyDivide 111 DIVISION SIGN (/) key
Function Keys 

Constant Value Description
vbKeyF1 112 F1 key
vbKeyF2 113 F2 key
vbKeyF3 114 F3 key
vbKeyF4 115 F4 key
vbKeyF5 116 F5 key
vbKeyF6 117 F6 key
vbKeyF7 118 F7 key
vbKeyF8 119 F8 key
vbKeyF9 120 F9 key
vbKeyF10 121 F10 key
vbKeyF11 122 F11 key
vbKeyF12 123 F12 key
vbKeyF13 124 F13 key
vbKeyF14 125 F14 key
vbKeyF15 126 F15 key
vbKeyF16 127 F16 key
Tópico encerrado , respostas não são mais permitidas