KeyString 属性

       

为指定的键返回组合键字符串(例如,Ctrl+Shift+A)。String 类型,只读。

expression.KeyString

expression   必需。该表达式返回一个 KeyBinding 对象。

示例

本示例显示 Normal 模板中的第一个自定义组合键的组合键字符串。

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

如果 KeyBindings 集合包含 Alt+Ctrl+W,则本示例显示一条消息。

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