J
John
I would like to display a shortcut key along with Excel's (2003) custom
menu, but can't figure out how to do it. Here's my sub to add my custom
menu:
Sub AddNewMenu()
Dim NewMenu As CommandBarControl
Dim NewItem As CommandBarControls
Dim HelpIndex As Integer
Dim Cap1, Cap2, Cap3, Cap4
Dim Mac1, Mac2, Mac3, Mac4
' Make sure the menus aren't duplicated
Call DeleteMenu
Cap1 = "&Insert Row, Copy Formula"
Cap2 = "&Delete Row on Database"
Cap3 = "&Add New Group"
' Get Index of Help Menu
HelpIndex = CommandBars(1).Controls("Help").Index
' Create the control
Set NewMenu = CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
before:=HelpIndex, Temporary:=True)
NewMenu.Caption = "Data&base menu"
NewMenu.BeginGroup = "True"
CommandBars(1).Controls("Help").BeginGroup = True
' Add Menu Item
Set NewItem = CommandBars(1). _
Controls("Database menu").Controls
With NewItem
.Add.Caption = Cap1
.Add.Caption = Cap2
.Add.Caption = Cap3
.Add.Caption = Cap4
End With
How can I add short cut text to this menu? For instance, with Cap1 above
("&Insert Row, Copy Formula") I'd like it to say Ctrl-I off to the right. .I
know it takes the ShortcutText property. Thank you
menu, but can't figure out how to do it. Here's my sub to add my custom
menu:
Sub AddNewMenu()
Dim NewMenu As CommandBarControl
Dim NewItem As CommandBarControls
Dim HelpIndex As Integer
Dim Cap1, Cap2, Cap3, Cap4
Dim Mac1, Mac2, Mac3, Mac4
' Make sure the menus aren't duplicated
Call DeleteMenu
Cap1 = "&Insert Row, Copy Formula"
Cap2 = "&Delete Row on Database"
Cap3 = "&Add New Group"
' Get Index of Help Menu
HelpIndex = CommandBars(1).Controls("Help").Index
' Create the control
Set NewMenu = CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
before:=HelpIndex, Temporary:=True)
NewMenu.Caption = "Data&base menu"
NewMenu.BeginGroup = "True"
CommandBars(1).Controls("Help").BeginGroup = True
' Add Menu Item
Set NewItem = CommandBars(1). _
Controls("Database menu").Controls
With NewItem
.Add.Caption = Cap1
.Add.Caption = Cap2
.Add.Caption = Cap3
.Add.Caption = Cap4
End With
How can I add short cut text to this menu? For instance, with Cap1 above
("&Insert Row, Copy Formula") I'd like it to say Ctrl-I off to the right. .I
know it takes the ShortcutText property. Thank you