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

Creating a Key Binding

To create a key binding and add it to the KeyBindings collection, use the Add method of the KeyBindings collection. The syntax for this Add method is:

	KeyBindings.Add(KeyCategory, Command, KeyCode, KeyCode2, CommandParameter)

The parameters of this method are described in detail later in this chapter, since they are also properties of the KeyBinding object.

To illustrate, the following code:

	KeyBindings.Add wdKeyCategoryFont, "Arial", _
	   BuildKeyCode(wdKeyAlt, wdKey9)

adds a new key binding with shortcut key Alt-9, whose command changes the font to Arial.

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