KeysBoundTo Property Example

This example displays all the key combinations assigned to the FileOpen command in the template attached to the active document.

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

This example removes all key assignments from Macro1 in the Normal template.

CustomizationContext = NormalTemplate
For Each aKey In _
        KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
        Command:="Macro1")
    aKey.Disable
Next aKey