O'Reilly logo

Writing Word Macros, Second Edition by Steven Roman PhD

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required