KeyString Method

Applies To

Application object, Global object.

Description

Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).

Syntax

expression.KeyString(KeyCode, KeyCode2)

expression Optional. An expression that returns an Application object.

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

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

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

See Also

BuildKeyCode method, KeyCode property, KeyCode2 property, KeyString property.

Example

This example displays the key combination string (CTRL+SHIFT+A) for the following WdKey constants: wdKeyControl, wdKeyShift, and wdKeyA.

CustomizationContext = ActiveDocument.AttachedTemplate
MsgBox KeyString(KeyCode:=BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyA))