Keycode 常量Keycode constants

可在代码中的任意位置使用以下常量来取代实际值:The following constants can be used anywhere in your code in place of the actual values.

常量Constant Value 说明Description
vbKeyLButtonvbKeyLButton 0x10x1 鼠标左键Left mouse button
vbKeyRButtonvbKeyRButton 0x20x2 鼠标右键Right mouse button
vbKeyCancelvbKeyCancel 0x30x3 Cancel 键CANCEL key
vbKeyMButtonvbKeyMButton 0x40x4 鼠标中键Middle mouse button
vbKeyBackvbKeyBack 0x80x8 Backspace 键BACKSPACE key
vbKeyTabvbKeyTab 0x90x9 Tab 键TAB key
vbKeyClearvbKeyClear 0xC0xC Clear 键CLEAR key
vbKeyReturnvbKeyReturn 0xD0xD Enter 键ENTER key
vbKeyShiftvbKeyShift 0x100x10 Shift 键SHIFT key
vbKeyControlvbKeyControl 0x110x11 Ctrl 键CTRL key
vbKeyMenuvbKeyMenu 0x120x12 Menu 键MENU key
vbKeyPausevbKeyPause 0x130x13 Pause 键PAUSE key
vbKeyCapitalvbKeyCapital 0x140x14 Caps Lock 键CAPS LOCK key
vbKeyEscapevbKeyEscape 0x1B0x1B Esc 键ESC key
vbKeySpacevbKeySpace 0x200x20 空格键SPACEBAR key
vbKeyPageUpvbKeyPageUp 0x210x21 Page Up 键PAGE UP key
vbKeyPageDownvbKeyPageDown 0x220x22 Page Down 键PAGE DOWN key
vbKeyEndvbKeyEnd 0x230x23 End 键END key
vbKeyHomevbKeyHome 0x240x24 Home 键HOME key
vbKeyLeftvbKeyLeft 0x250x25 向左键LEFT ARROW key
vbKeyUpvbKeyUp 0x260x26 向上键UP ARROW key
vbKeyRightvbKeyRight 0x270x27 向右键RIGHT ARROW key
vbKeyDownvbKeyDown 0x280x28 向下键DOWN ARROW key
vbKeySelectvbKeySelect 0x290x29 Select 键SELECT key
vbKeyPrintvbKeyPrint 0x2A0x2A Print Screen 键PRINT SCREEN key
vbKeyExecutevbKeyExecute 0x2B0x2B Execute 键EXECUTE key
vbKeySnapshotvbKeySnapshot 0x2C0x2C Snapshot 键SNAPSHOT key
vbKeyInsertvbKeyInsert 0x2D0x2D Insert 键INSERT key
vbKeyDeletevbKeyDelete 0x2E0x2E Delete 键DELETE key
vbKeyHelpvbKeyHelp 0x2F0x2F Help 键HELP key
vbKeyNumlockvbKeyNumlock 0x900x90 Num Lock 键NUM LOCK key

A-z 键A key - Z key

A 键到 Z 键与–z 的 ASCII 等效项相同。The A key through the Z key are the same as the ASCII equivalents A–Z.

常量Constant Value 说明Description
vbKeyAvbKeyA 6565 A 键A key
vbKeyBvbKeyB 6666 B 键B key
vbKeyCvbKeyC 6767 C 键C key
vbKeyDvbKeyD 6868 D 键D key
vbKeyEvbKeyE 6969 E 键E key
vbKeyFvbKeyF 7070 F 键F key
vbKeyGvbKeyG 7171 G 键G key
vbKeyHvbKeyH 7272 H 键H key
vbKeyIvbKeyI 7373 I 键I key
vbKeyJvbKeyJ 7474 J 键J key
vbKeyKvbKeyK 7575 K 键K key
vbKeyLvbKeyL 7676 L 键L key
vbKeyMvbKeyM 7777 M 键M key
vbKeyNvbKeyN 7878 N 键N key
vbKeyOvbKeyO 7979 O 键O key
vbKeyPvbKeyP 8080 P 键P key
vbKeyQvbKeyQ 8181 Q 键Q key
vbKeyRvbKeyR 8282 R 键R key
vbKeySvbKeyS 8383 S 键S key
vbKeyTvbKeyT 8484 T 键T key
vbKeyUvbKeyU 8585 U 键U key
vbKeyVvbKeyV 8686 V 键V key
vbKeyWvbKeyW 8787 W 键W key
vbKeyXvbKeyX 8888 X 键X key
vbKeyYvbKeyY 8989 Y 键Y key
vbKeyZvbKeyZ 9090 Z 键Z key

0键-9 键0 key - 9 key

0键到9键与它们的 ASCII 等价物 0–9 相同。The 0 key through 9 key are the same as their ASCII equivalents 0–9.

常量Constant Value 说明Description
vbKey0vbKey0 4848 0 键0 key
vbKey1vbKey1 4949 1 键1 key
vbKey2vbKey2 5050 2 键2 key
vbKey3vbKey3 5151 3 键3 key
vbKey4vbKey4 5252 4 键4 key
vbKey5vbKey5 5353 5 键5 key
vbKey6vbKey6 5454 6 键6 key
vbKey7vbKey7 5555 7 键7 key
vbKey8vbKey8 5656 8 键8 key
vbKey9vbKey9 5757 9 键9 key

数字键盘键Numeric keypad keys

以下常量表示数字键盘上的键。The following constants represent keys on the numeric keypad.

常量Constant Value 说明Description
vbKeyNumpad0vbKeyNumpad0 0x600x60 0 键0 key
vbKeyNumpad1vbKeyNumpad1 0x610x61 1 键1 key
vbKeyNumpad2vbKeyNumpad2 0x620x62 2 键2 key
vbKeyNumpad3vbKeyNumpad3 0x630x63 3 键3 key
vbKeyNumpad4vbKeyNumpad4 0x640x64 4 键4 key
vbKeyNumpad5vbKeyNumpad5 0x650x65 5 键5 key
vbKeyNumpad6vbKeyNumpad6 0x660x66 6 键6 key
vbKeyNumpad7vbKeyNumpad7 0x670x67 7 键7 key
vbKeyNumpad8vbKeyNumpad8 0x680x68 8 键8 key
vbKeyNumpad9vbKeyNumpad9 0x690x69 9 键9 key
vbKeyMultiplyvbKeyMultiply 0x6A0x6A 乘号 (*) 键MULTIPLICATION SIGN (*) key
vbKeyAddvbKeyAdd 0x6B0x6B 加号 (+) 键PLUS SIGN (+) key
vbKeySeparatorvbKeySeparator 0x6C0x6C Enter 键ENTER key
vbKeySubtractvbKeySubtract 0x6D0x6D 减号 (-) 键MINUS SIGN (-) key
vbKeyDecimalvbKeyDecimal 0x6E0x6E 小数点 (.) 键DECIMAL POINT (.) key
vbKeyDividevbKeyDivide 0x6F0x6F 除号 (/) 键DIVISION SIGN (/) key

功能键Function keys

以下常量代表功能键。The following constants represent function keys.

常量Constant Value 说明Description
vbKeyF1vbKeyF1 0x700x70 F1 键F1 key
vbKeyF2vbKeyF2 0x710x71 F2 键F2 key
vbKeyF3vbKeyF3 0x720x72 F3 键F3 key
vbKeyF4vbKeyF4 0x730x73 F4 键F4 key
vbKeyF5vbKeyF5 0x740x74 F5 键F5 key
vbKeyF6vbKeyF6 0x750x75 F6 键F6 key
vbKeyF7vbKeyF7 0x760x76 F7 键F7 key
vbKeyF8vbKeyF8 0x770x77 F8 键F8 key
vbKeyF9vbKeyF9 0x780x78 F9 键F9 key
vbKeyF10vbKeyF10 0x790x79 F10 键F10 key
vbKeyF11vbKeyF11 0x7A0x7A F11 键F11 key
vbKeyF12vbKeyF12 0x7B0x7B F12 键F12 key
vbKeyF13vbKeyF13 0x7C0x7C F13 键F13 key
vbKeyF14vbKeyF14 0x7D0x7D F14 键F14 key
vbKeyF15vbKeyF15 0x7E0x7E F15 键F15 key
vbKeyF16vbKeyF16 0x7F0x7F F16 键F16 key

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.