Modifica

Condividi tramite


KeyBindings.Add(WdKeyCategory, String, Int32, Object, Object) Method

Definition

Returns a KeyBinding object that represents a new shortcut key for a macro, built-in command, font, AutoText entry, style, or symbol.

public Microsoft.Office.Interop.Word.KeyBinding Add (Microsoft.Office.Interop.Word.WdKeyCategory KeyCategory, string Command, int KeyCode, ref object KeyCode2, ref object CommandParameter);
abstract member Add : Microsoft.Office.Interop.Word.WdKeyCategory * string * int * obj * obj -> Microsoft.Office.Interop.Word.KeyBinding
Public Function Add (KeyCategory As WdKeyCategory, Command As String, KeyCode As Integer, Optional ByRef KeyCode2 As Object, Optional ByRef CommandParameter As Object) As KeyBinding

Parameters

KeyCategory
WdKeyCategory

Required WdKeyCategory. The category of the key assignment.

Command
String

Required String. The command that the specified key combination executes.

KeyCode
Int32

Required Integer. A key you specify by using one of the WdKey constants.

KeyCode2
Object

Optional Object. A second key you specify by using one of the WdKey constants.

CommandParameter
Object

Optional Object. Additional text, if any, required for the command specified by Command. For details, see the Remarks section below.

Returns

Remarks

You can use the BuildKeyCode(WdKey, Object, Object, Object) method to create the KeyCode or KeyCode2 argument.

In the following table, the left-hand column contains commands that require a command value, and the right-hand column describes what you must do to specify CommandParameter for each of these commands. (The equivalent action in the Customize Keyboard dialog box (Tools menu) to specifying CommandParameter is selecting an item in the list box that appears when you select one of the following commands in the Commands box.)

Borders, Color, or ShadingA number— specified as text— corresponding to the position of the setting selected in the list box that contains values, where 0 (zero) is the first item, 1 is the second item, and so on
Columns A number between 1 and 45— specified as text— corresponding to the number of columns you want to apply
Condensed A text measurement between 0.1 point and 12.75 points specified in 0.05-point increments (72 points = 1 inch)
Expanded A text measurement between 0.1 point and 12.75 points specified in 0.05-point increments (72 points = 1 inch)
FileOpenFile The path and file name of the file to be opened. If the path isn't specified, the current folder is used.
Font Size A positive text measurement, specified in 0.5-point increments (72 points = 1 inch)
Lowered, RaisedA text measurement between 1 point and 64 points, specified in 0.5-point increments (72 points = 1 inch)
Symbol A string created by concatenating a Chr() instruction and the name of a symbol font (for example, Chr(167) & "Symbol")

Applies to