Addin-specific keyboard shortcuts refuse to turn off
Hi folks. I have an .dotm add-in containing about 20 macros. It also contains two other macros that let my users enable or disable a set of keyboard shortcuts for these macros as needed -- that is, only for specific documents. (The shortcuts commandeer some commonly used built-in key combinations, so I want them enabled only when a user explicitly allows it.) I've done this successfully before. But on this file, for some reason, merely loading the add-in enables the shortcuts -- in all documents.
I've confirmed via the Customize Keyboard dialog that these shortcuts are *not* enabled in the .dotm itself, but I've also explicitly disabled them via code just in case. I've tried unloading all other add-ins and had Word rebuild the Normal template to verify they're not hiding there either. No luck. I'm sure they're enabled in the add-in. (They go away if I unload it.)
What could be causing this?? There are no automacros in the file, and the shortcut-enabling macro (see below) isn't called by any other macro. All shortcuts are set with the Customization Context shown, the active document. (not Normal or ThisDoc).
Sub KM1(mac, k1)
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(k1), _
KeyCategory:=wdKeyCategoryMacro, Command:=mac
End Sub
Sub KM2(mac, k1, k2)
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(k1, k2), _
KeyCategory:=wdKeyCategoryMacro, Command:=mac
End Sub
Sub EnableShortcuts
KM1 "LengthenLine", wdKeyF4
KM1 "ShortenLine", wdKeyF5
[...and so on...]
KM2 "SelectPrevPair", wdKeyControl, wdKeyF4
KM2 "SelectNextPair", wdKeyControl, wdKeyF5
[...and so on...]
Thanks in advance for any clues at all.
Mark
|