CommandBarButtons have a ShortcutText property that you can use to list a command’s shortcut next to its menu item. The Cut menu item has Ctrl+X listed next to it.
In this example, I make a new menu with one item under it. OnKey is used to assign a keyboard shortcut and the ShortcutText property is used to communicate that to the user. Note that using the ShortcutText property does not actually establish the keyboard shortcut.
Dim cbPop As CommandBarPopup
Set cbPop = Application.CommandBars(1).Controls.Add(msoControlPopup)
Application.OnKey “^+C”, “Choice1”
.Caption = “MainMenu”
.Caption = “Choice1”
.OnAction = “Choice1”
.ShortcutText = “Ctrl+Shift+C”
And to get rid of it:
On Error Resume Next
Another way to assign a shortcut key is through MacroOptions. It’s the same as Tools > Macro > Macros, then selecting the Option button.
I always use OnKey, but I’m not aware of any problems with this method. The “C” argument means Ctrl+Shift+C. All of the shortcuts established with MacroOptions start with Ctrl. You establish the Shift part by specifying a capital or lowercase C.