The KeyBinding Object
The following list describes some of the properties and methods of a KeyBinding object:
- The Clear method
Removes the key binding from the KeyBindings collection and also resets a built-in command to its default key assignment. The syntax is:
KeyBinding.Clear
The ClearAll method of the KeyBindings collection can be used to clear all custom key bindings and reset the default key bindings.
- The Command property
This read-only property returns the command assigned to the specified key combination as a string. A list of the more than 1,000 commands is available from the Customize menu item (under the Tools menu). Those commands whose names are followed by a colon require a command parameter. In addition to the well-known Word commands such as New, Open, Print, Bold, and Italic, there are a great many commands that most Word users have never encountered, such as Auto Correct Exceptions, Bookshelf Lookup Reference, Control Run, and so on.
- The CommandParameter property
This read-only property returns a string containing the command parameter for the key binding. If the command in question takes no parameters, this property returns an empty string.
For instance, the
FileOpenFilecommand (which opens a specific file) requires a string parameter that specifies the filename (and path) for the file to open. TheSymbolcommand requires a string of the form:Chr(
x) &FontNamewhere
xis a character code andFontNameis the name of a symbol font, as in:Chr(125) & " Symbol"
For more ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access