Table of contents
TOC
Collapse the table of content
Expand the table of content

Keycode Constants

office 365 dev account|Last Updated: 1/23/2018
|
2 Contributors

The following constants can be used anywhere in your code in place of the actual values:

ConstantValueDescription
vbKeyLButton0x1Left mouse button
vbKeyRButton0x2Right mouse button
vbKeyCancel0x3CANCEL key
vbKeyMButton0x4Middle mouse button
vbKeyBack0x8BACKSPACE key
vbKeyTab0x9TAB key
vbKeyClear0xCCLEAR key
vbKeyReturn0xDENTER key
vbKeyShift0x10SHIFT key
vbKeyControl0x11CTRL key
vbKeyMenu0x12MENU key
vbKeyPause0x13PAUSE key
vbKeyCapital0x14CAPS LOCK key
vbKeyEscape0x1BESC key
vbKeySpace0x20SPACEBAR key
vbKeyPageUp0x21PAGE UP key
vbKeyPageDown0x22PAGE DOWN key
vbKeyEnd0x23END key
vbKeyHome0x24HOME key
vbKeyLeft0x25LEFT ARROW key
vbKeyUp0x26UP ARROW key
vbKeyRight0x27RIGHT ARROW key
vbKeyDown0x28DOWN ARROW key
vbKeySelect0x29SELECT key
vbKeyPrint0x2APRINT SCREEN key
vbKeyExecute0x2BEXECUTE key
vbKeySnapshot0x2CSNAPSHOT key
vbKeyInsert0x2DINSERT key
vbKeyDelete0x2EDELETE key
vbKeyHelp0x2FHELP key
vbKeyNumlock0x90NUM LOCK key

The A key through the Z key are the same as the ASCII equivalents A - Z:

ConstantValueDescription
vbKeyA65A key
vbKeyB66B key
vbKeyC67C key
vbKeyD68D key
vbKeyE69E key
vbKeyF70F key
vbKeyG71G key
vbKeyH72H key
vbKeyI73I key
vbKeyJ74J key
vbKeyK75K key
vbKeyL76L key
vbKeyM77M key
vbKeyN78N key
vbKeyO79O key
vbKeyP80P key
vbKeyQ81Q key
vbKeyR82R key
vbKeyS83S key
vbKeyT84T key
vbKeyU85U key
vbKeyV86V key
vbKeyW87W key
vbKeyX88X key
vbKeyY89Y key
vbKeyZ90Z key

The 0 key through 9 key are the same as their ASCII equivalents 0 - 9:

ConstantValueDescription
vbKey0480 key
vbKey1491 key
vbKey2502 key
vbKey3513 key
vbKey4524 key
vbKey5535 key
vbKey6546 key
vbKey7557 key
vbKey8568 key
vbKey9579 key

The following constants represent keys on the numeric keypad:

ConstantValueDescription
vbKeyNumpad00x600 key
vbKeyNumpad10x611 key
vbKeyNumpad20x622 key
vbKeyNumpad30x633 key
vbKeyNumpad40x644 key
vbKeyNumpad50x655 key
vbKeyNumpad60x666 key
vbKeyNumpad70x677 key
vbKeyNumpad80x688 key
vbKeyNumpad90x699 key
vbKeyMultiply0x6AMULTIPLICATION SIGN ( \* ) key
vbKeyAdd0x6BPLUS SIGN ( + ) key
vbKeySeparator0x6CENTER key
vbKeySubtract0x6DMINUS SIGN ( - ) key
vbKeyDecimal0x6EDECIMAL POINT ( . ) key
vbKeyDivide0x6FDIVISION SIGN ( / ) key

The following constants represent function keys:

ConstantValueDescription
vbKeyF10x70F1 key
vbKeyF20x71F2 key
vbKeyF30x72F3 key
vbKeyF40x73F4 key
vbKeyF50x74F5 key
vbKeyF60x75F6 key
vbKeyF70x76F7 key
vbKeyF80x77F8 key
vbKeyF90x78F9 key
vbKeyF100x79F10 key
vbKeyF110x7AF11 key
vbKeyF120x7BF12 key
vbKeyF130x7CF13 key
vbKeyF140x7DF14 key
vbKeyF150x7EF15 key
vbKeyF160x7FF16 key
© 2018 Microsoft