Returns a unique number for the specified key combination.
expression.BuildKeyCode(Arg1, Arg2, Arg3, Arg4)
expression Optional. An expression that returns an Application object.
Arg1 Required WdKey. A key you specify by using one of the WdKey constants.
WdKey can be one of these WdKey constants. |
wdKeyF |
wdKeyF10 |
wdKeyF12 |
wdKeyF14 |
wdKeyF16 |
wdKeyF3 |
wdKeyF5 |
wdKeyF7 |
wdKeyF9 |
wdKeyH |
wdKeyHyphen |
wdKeyInsert |
wdKeyK |
wdKeyL |
wdKeyM |
wdKeyN |
wdKeyNumeric0 |
wdKeyNumeric1 |
wdKeyNumeric2 |
wdKeyNumeric3 |
wdKeyNumeric4 |
wdKeyNumeric5 |
wdKeyNumeric5Special |
wdKeyNumeric6 |
wdKeyNumeric7 |
wdKeyNumeric8 |
wdKeyNumeric9 |
wdKeyNumericAdd |
wdKeyNumericDecimal |
wdKeyNumericDivide |
wdKeyNumericMultiply |
wdKeyNumericSubtract |
wdKeyO |
wdKeyOpenSquareBrace |
wdKeyOption |
wdKeyP |
wdKeyPageDown |
wdKeyPageUp |
wdKeyPause |
wdKeyPeriod |
wdKeyQ |
wdKeyR |
wdKeyReturn |
wdKeyS |
wdKeyScrollLock |
wdKeySemiColon |
wdKeyShift |
wdKeySingleQuote |
wdKeySlash |
wdKeySpacebar |
wdKeyT |
wdKeyTab |
wdKeyU |
wdKeyV |
wdKeyW |
wdKeyX |
wdKeyY |
wdKeyZ |
wdNoKey |
wdKey0 |
wdKey1 |
wdKey2 |
wdKey3 |
wdKey4 |
wdKey5 |
wdKey6 |
wdKey7 |
wdKey8 |
wdKey9 |
wdKeyA |
wdKeyAlt |
wdKeyB |
wdKeyBackSingleQuote |
wdKeyBackSlash |
wdKeyBackspace |
wdKeyC |
wdKeyCloseSquareBrace |
wdKeyComma |
wdKeyCommand |
wdKeyControl |
wdKeyD |
wdKeyDelete |
wdKeyE |
wdKeyEnd |
wdKeyEquals |
wdKeyEsc |
wdKeyF1 |
wdKeyF11 |
wdKeyF13 |
wdKeyF15 |
wdKeyF2 |
wdKeyF4 |
wdKeyF6 |
wdKeyF8 |
wdKeyG |
wdKeyHome |
wdKeyI |
wdKeyJ |
Arg2 - Arg4 Optional WdKey. A key you specify by using one of the WdKey constants.
WdKey can be one of these WdKey constants. |
wdKeyF |
wdKeyF10 |
wdKeyF12 |
wdKeyF14 |
wdKeyF16 |
wdKeyF3 |
wdKeyF5 |
wdKeyF7 |
wdKeyF9 |
wdKeyH |
wdKeyHyphen |
wdKeyInsert |
wdKeyK |
wdKeyL |
wdKeyM |
wdKeyN |
wdKeyNumeric0 |
wdKeyNumeric1 |
wdKeyNumeric2 |
wdKeyNumeric3 |
wdKeyNumeric4 |
wdKeyNumeric5 |
wdKeyNumeric5Special |
wdKeyNumeric6 |
wdKeyNumeric7 |
wdKeyNumeric8 |
wdKeyNumeric9 |
wdKeyNumericAdd |
wdKeyNumericDecimal |
wdKeyNumericDivide |
wdKeyNumericMultiply |
wdKeyNumericSubtract |
wdKeyO |
wdKeyOpenSquareBrace |
wdKeyOption |
wdKeyP |
wdKeyPageDown |
wdKeyPageUp |
wdKeyPause |
wdKeyPeriod |
wdKeyQ |
wdKeyR |
wdKeyReturn |
wdKeyS |
wdKeyScrollLock |
wdKeySemiColon |
wdKeyShift |
wdKeySingleQuote |
wdKeySlash |
wdKeySpacebar |
wdKeyT |
wdKeyTab |
wdKeyU |
wdKeyV |
wdKeyW |
wdKeyX |
wdKeyY |
wdKeyZ |
wdNoKey |
wdKey0 |
wdKey1 |
wdKey2 |
wdKey3 |
wdKey4 |
wdKey5 |
wdKey6 |
wdKey7 |
wdKey8 |
wdKey9 |
wdKeyA |
wdKeyAlt |
wdKeyB |
wdKeyBackSingleQuote |
wdKeyBackSlash |
wdKeyBackspace |
wdKeyC |
wdKeyCloseSquareBrace |
wdKeyComma |
wdKeyCommand |
wdKeyControl |
wdKeyD |
wdKeyDelete |
wdKeyE |
wdKeyEnd |
wdKeyEquals |
wdKeyEsc |
wdKeyF1 |
wdKeyF11 |
wdKeyF13 |
wdKeyF15 |
wdKeyF2 |
wdKeyF4 |
wdKeyF6 |
wdKeyF8 |
wdKeyG |
wdKeyHome |
wdKeyI |
wdKeyJ |
Example
This example assigns the ALT + F1 key combination to the Organizer command.
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(Arg1:=wdKeyAlt, _
Arg2:=wdKeyF1), KeyCategory:=wdKeyCategoryCommand, _
Command:="Organizer"
This example removes the ALT+F1 key assignment from the Normal template.
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear
This example displays the command assigned to the F1 key.
CustomizationContext = NormalTemplate
MsgBox FindKey(BuildKeyCode(Arg1:=wdKeyF1)).Command