KeysBoundTo Collection Object

Multiple objects
KeysBoundTo
KeyBinding

A collection of KeyBinding objects assigned to a command, style, macro, or other item in the current context.

Using the KeysBoundTo Collection

Use the KeysBoundTo property to return the KeysBoundTo collection. The following example displays the key combinations assigned to the FileNew command in the Normal template.

CustomizationContext = NormalTemplate
For Each myKey In KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
    Command:="FileNew")
    myStr = myStr & myKey.KeyString & vbCr
Next myKey
MsgBox myStr

The following example displays the name of the document or template where the keys for the macro named "Macro1" are stored.

Set kb = KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
    Command:="Macro1")
MsgBox kb.Context.Name

Properties | Application Property | Command Property | CommandParameter Property | Context Property | Count Property | Creator Property | KeyCategory Property | Parent Property

Methods | Item Method | Key Method

Parent Objects | Application | Global

Child Objects

See Also | KeyBinding Object | KeyBindings Collection Object