KeyBindings Property

Applies To

Application object, Global object.

Description

Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command. Read-only.

See Also

Add method (KeyBindings collection), BuildKeyCode method, Command property, CustomizationContext property, ListCommands method.

Example

This example assigns the CTRL+ALT+W key combination to the FileClose command. This keyboard customization is saved in the Normal template.

CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyW), _
    KeyCategory:=wdKeyCategoryCommand, Command:="FileClose"
This example inserts the command name and key combination string for each item in the KeyBindings collection.

CustomizationContext = NormalTemplate
For Each aKey In KeyBindings
    Selection.InsertAfter aKey.Command & vbTab & aKey.KeyString & vbCr
    Selection.Collapse Direction:=wdCollapseEnd
Next aKey