KeyBinding.KeyCode property (Word)
Returns a unique number for the first key in the specified key binding. Read-only Long.
Syntax
expression. KeyCode
expression An expression that returns a 'KeyBinding' object.
Remarks
You create this number by using the BuildKeyCode method when you are adding key bindings by using the Add method of the KeyBindings object.
Example
This example displays a message if the KeyBindings collection includes the ALT+CTRL+W key combination.
Dim lngCode As Long
Dim kbLoop As KeyBinding
CustomizationContext = NormalTemplate
lngCode = BuildKeyCode(wdKeyAlt, wdKeyControl, wdKeyW)
For Each kbLoop In KeyBindings
If lngCode = kbLoop.KeyCode Then
MsgBox kbLoop.KeyString & " is already in use"
End If
Next kbLoop
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for