VBA - Shortcut Submenu

B

bforster1

I have the following code which creates a short cut menu but would lik
to have a submenu for "Go To". Any suggestions??

Sub CreateShortcut()
Dim myBar As CommandBar
Dim myItem As CommandBarControl

DeleteShortcut
Set myBar = CommandBars.Add _
(Name:="MyShortcut", Position:=msoBarPopup, Temporary:=True)

Set myItem = myBar.Controls.Add(Type:=msoControlButton)
With myItem
.Caption = "&Go To.."
.OnAction = "ShowFormatNumber"
.FaceId = 1554
End Wit
 
D

Dave Peterson

How about:

Application.MacroOptions Macro:="showformatnumber", _
HasShortcutKey:=True, ShortcutKey:="C"

This uses ctrl-C (uppercase C) as the shortcut.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top