Organizing Your Keyboard Shortcuts in Microsoft Word

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@ghasemkiani·
0.000 HBD
Organizing Your Keyboard Shortcuts in Microsoft Word
In the [previous post](https://steemit.com/vba/@ghasemkiani/creating-keyboard-shortcuts-with-macros-in-microsoft-word), I described how you can define keyboard shortcuts from VBA in Microsoft Word. As I said, this is a powerful technique that can boost your productivity greatly. Now, consider this situation. What if you want to have multiple sets of shortcuts that can be switched easily? For example, you may have a set of shortcuts for working with drawing objects, another set for working with text, etc. The whole point is that if you can switch whole sets of shortcuts, you can reassign familiar key combinations to other actions.

This can be easily done. For each set of shortcuts, create a macro that defines the shortcut keys and a macro that clears those shortcuts. That's all it takes to have multiple sets of easily interchangeable shortcut sets.

Here is an example:

```vba
	Sub DefineSet1()
		KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, Command:="ViewWeb", KeyCode:=BuildKeyCode(wdKeyW, wdKeyAlt, wdKeyControl)
		KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, Command:="MyMacro", KeyCode:=BuildKeyCode(wdKeyS, wdKeyAlt, wdKeyShift)
		KeyBindings.Add KeyCategory:=wdKeyCategoryStyle, Command:="MyStyle", KeyCode:=BuildKeyCode(wdKeyC, wdKeyAlt, wdKeyControl, wdKeyShift)
		KeyBindings.Add KeyCategory:=wdKeyCategorySymbol, Command:=" " & ChrW(Val("&H2011")), KeyCode:=BuildKeyCode(wdKeyHyphen, wdKeyAlt, wdKeyControl, wdKeyShift)
	End Sub
	Sub ClearSet1()
		FindKey(BuildKeyCode(wdKeyW, wdKeyAlt, wdKeyControl)).Clear
		FindKey(BuildKeyCode(wdKeyS, wdKeyAlt, wdKeyShift)).Clear
		FindKey(BuildKeyCode(wdKeyC, wdKeyAlt, wdKeyControl, wdKeyShift)).Clear
		FindKey(BuildKeyCode(wdKeyHyphen, wdKeyAlt, wdKeyControl, wdKeyShift)).Clear
	End Sub
```
For each set of shortcut keys, you must create one macro for assigning the key combinations and one macro for clearing them. By running the respective macros, you can easily switch between multiple sets of shortcut keys.

---

## Related Posts

* [Creating Keyboard Shortcuts with Macros in Microsoft Word](https://steemit.com/vba/@ghasemkiani/creating-keyboard-shortcuts-with-macros-in-microsoft-word)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , ,