Hi - can anyone help? I'm not sure whether this is a coding issue or a front end problem, hence placing the question in this location.
I am working with Office 2007 and have a Quick Styles file (dotx) that will be deployed as part of an Office Theme in Word. We have a number of shortcut keys we want to set for specific styles, within this dotx file, but appear to be experiencing problems. When opening the dotx file the shortcut keys appear, on selecting the dotx file via the Style Set in Word the shortcut keys no longer appear. When opening specific styles that in the dotx file have an allocated shortcut key the key does not appear and the option to save a shortcut key to the dotx is not available, you only have access to Normal.dotm or the physical document that is open.
Should I be setting the style up in Normal.dotm or is it feasible that the dotx file can register the shortcut keys? If Normal is the only option, can this be achieved through VB (have taken a look and cannot see any obvious way to set a shortcut key programmatically)? I am not in a position to override Normal.dotm so will need to create code that runs on each user's PC so we do not encounter any data loss if a user has been making changes to Normal.
Thanks in advance
Jack
Setting shortcut keys around Word Styles
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
-
- Administrator
- Posts: 77253
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Setting shortcut keys around Word Styles
You can use KeyBindings to assign keybard shortcuts programmatically.
Example:
CustomizationContext = NormalTemplate
KeyBindings.Add wdKeyCategoryStyle, "MyStyle", BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyM)
This assigns MyStyle to Ctrl+Alt+M. See KeyBindings Collection Object and Add Method.
Example:
CustomizationContext = NormalTemplate
KeyBindings.Add wdKeyCategoryStyle, "MyStyle", BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyM)
This assigns MyStyle to Ctrl+Alt+M. See KeyBindings Collection Object and Add Method.
Regards,
Hans
Hans
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Setting shortcut keys around Word Styles
Many thanks as always Hans.