Disable Method Example

This example removes the CTRL+SHIFT+B key assignment. This key combination is assigned to the Bold command by default.

CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyB)).Disable

This example assigns the CTRL+SHIFT+O key combination to the Organizer command. The example then uses the Disable method to remove the CTRL+SHIFT+O key combination and displays a message.

CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyO, _
    wdKeyControl, wdKeyShift), _
    KeyCategory:=wdKeyCategoryCommand, Command:="Organizer"
With FindKey(BuildKeyCode(wdKeyO, wdKeyControl, wdKeyShift))
    MsgBox .Command & " is assigned to CTRL+Shift+O"
    .Disable
    If .Command = "" Then MsgBox _
        "Nothing is assigned to CTRL+Shift+O"
End With

This example removes all key assignments for the global macro named "Macro1."

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