Article ID: 254708
Article Last Modified on 11/23/2006
APPLIES TO
- Microsoft Word 2000 Standard Edition
This article was previously published under Q254708
SUMMARY
This article provides undocumented information about the Microsoft Visual Basic constants WdKeyCategoryPrefix, WdKeyCategoryDisable, and WdKeyCategoryNil.
MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
WdKeyCategoryPrefix is used in the constant group WdKeyCategory, which is used to add key customizations and look at their properties.
For example, if you create the custom key combination, ALT+A,B, to map to a command, ALT+A is considered a prefix key customization; it is a prefix to the whole keystroke.
In the following sample codeKeybindings.Add wdKeyCategoryCommand, "Bold", wdKeyAlt+wdKeyC,wdKeyD
pressing ALT+C,D applies the bold command.
The following codeMsgBox Keybindings(1).KeyCategory
returns 1, which is wdKeyCategoryCommand.
The following codeMsgBox Application.FindKey(wdKeyAlt+wdKeyC).KeyCategory
returns 7, which is wdKeyCategoryPrefix.
NOTE: You never use wdKeyCategoryPrefix when adding a key customization; it is just a side effect.WdKeyCategoryDisable may be used to disable hotkeys. The following sample code disables CTRL+K (for inserting a hyperlink) in Microsoft Word:
Sub DisableHotKeyInWord() Application.KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyK), KeyCategory:=wdKeyCategoryDisable, Command:="" End Sub
WdKeyCategoryNil is used when a key combination called programmatically does nothing, as in the following sample code:
Dim oKey as object Set oKey = application.findkey(Application.BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyX)) oKey.execute
NOTE: Using this or similar code that uses the WdKeyCategoryNil constant may cause an unexpected run-time error.
Keywords: kbinfo KB254708