KeyString Property

Microsoft Word Visual Basic

KeyString Property

       

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

expression.KeyString

expression   Required. An expression that returns a KeyBinding object.

Example

This example displays the key combination string for the first customized key combination in the Normal template.

CustomizationContext = NormalTemplate
If KeyBindings.Count >= 1 Then
    MsgBox KeyBindings(1).KeyString
End If

This example displays a message if the KeyBindings collection includes the ALT+CTRL+W key combination.

Dim aCode As Long
Dim aKey As KeyBinding

CustomizationContext = NormalTemplate
aCode = BuildKeyCode(wdKeyAlt, wdKeyControl, wdKeyW)
For Each aKey In KeyBindings
    If aCode = aKey.KeyCode Then
        MsgBox aKey.KeyString & " is already in use"
    End If
Next aKey