Chapter 18. Shortcut Key Bindings

In this chapter:

  • Finding a Key Binding

  • Creating a Key Binding

  • The KeyBinding Object

A KeyBinding object represents a custom key assignment in the current context: document, template, or application (normal template). Note that custom key assignments can be made in the Customize Keyboard dialog box (see Figure 18-1) as well. KeyBinding objects are members of the KeyBindings collection.

A key binding consists of several things, as reflected in the Customize keyboard dialog box shown in Figure 18-1. First, a key binding requires a Word command (such as FileOpenFile) that is executed when the keystrokes are invoked. This command may require a command parameter (such as a filename). Second, a key binding requires a key combination (such as Alt-O,1) that invokes the command. As you will learn, this key combination is described by a key code.

The Customize Keyboard dialog box

Figure 18-1. The Customize Keyboard dialog box

I will describe a couple of examples before discussing the individual properties and methods of the KeyBinding and other objects.

Finding a Key Binding

It is time to fulfill a promise given in the Preface to show you how to find renegade shortcut key assignments. But first, let me review the situation. While experimenting with the material for this chapter, I created a shortcut for the FileOpenFile command and assigned it the hotkey combination Alt-O,1, forgetting that Alt-O ...

Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.