CommandParameter Property

Microsoft Word Visual Basic

CommandParameter Property

       

Returns the command parameter assigned to the specified shortcut key. Read-only String.

Note   For information about commands that take parameters, see Add Method (KeyBindings Object). Use the Command property to return the command name assigned to the specified shortcut key.

Example

This example assigns a shortcut key to the FontSize command, with a command parameter of 8. Use the CommandParameter property to display the command parameter along with the command name and key string.

Dim kbNew As KeyBinding

Set kbNew = KeyBindings.Add(KeyCategory:=wdKeyCategoryCommand, _
    Command:="FontSize", _
    KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyS), _
    CommandParameter:="8")
MsgBox kbNew.Command & Chr$(32) & kbNew.CommandParameter _
    & vbCr & kbNew.KeyString