Shortcut Property
Description
Collection of shortcut items.
Property Type
Read-only property.
Syntax (Visual Basic)
Public Property Shortcut( _
ByVal [Index](#) As Long _
) As [KeyBinding](XtremeCommandBars~KeyBinding.md)
Parameters
- Index: Index of the specified shortcut.
Remarks
This collection is useful for iterating through all key bindings that have been added to command bar controls.
Example
KeyBinding Sample (Visual Basic)
Shows how to find a shortcut by CommandBar Control ID and how to iterate through all shortcuts.
Dim KeyBindings As KeyBindings
Set KeyBindings = CommandBars.KeyBindings
KeyBindings.AddShortcut ID_FILE_NEW, "Ctrl+N"
KeyBindings.AddShortcut ID_FILE_OPEN, "Ctrl+O"
KeyBindings.AddShortcut ID_FILE_SAVE, "Ctrl+S"
KeyBindings.AddShortcut ID_EDIT_CUT, "Ctrl+X"
KeyBindings.AddShortcut ID_EDIT_COPY, "Ctrl+C"
Dim keyShortcut As KeyBinding
' Finds a shortcut by command bar ID
keyShortcut = KeyBindings.FindShortcut(ID_FILE_NEW)
If Not keyShortcut Is Nothing Then
Debug.Print "The command bar control that uses this shortcut has an ID of " & keyShortcut.Command
Debug.Print "The shortcut text for command bar control with ID of " & keyShortcut.Command & " is " & keyShortcut.ShortcutText
End If
For Each keyShortcut In KeyBindings
Debug.Print "The command bar control that uses this shortcut has an ID of " & keyShortcut.Command
Debug.Print "The shortcut text for command bar control with ID of " & keyShortcut.Command & " is " & keyShortcut.ShortcutText
Next
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.