Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
shortcut for menu
HI,
in the following code I create a custom menu but I would like to have the shortcut to be set for the button and written in the menu. I can't find where to put them ? Can someone advise, thanks a lot Dim cbar As Office.CommandBar Dim monoutil As CommandBarControl Dim menu1, cbctl1, cbctl2, cbctl3, cbctl4 As CommandBarControl Dim sub1, sub2, sub3 As CommandBarButton 'create a control popup on the main Worksheet menu bar Set monoutil = Application.CommandBars("worksheet menu bar").Controls.Add(Type:=msoControlPopup) monoutil.Caption = "&Sbops-Tool 1.0" monoutil.Visible = True 'add a menu item Set cbctl1 = monoutil.Controls.Add(Type:=msoControlButton) With cbctl1 .Visible = True .Style = msoButtonIconAndCaption .Caption = "Create an import File" ' is required for caption .OnAction = ThisWorkbook.Name & "! outils.importfile" 'action to perform .FaceId = 2670 End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
shortcut for menu
Douvid,
I don't think the control's property that shows the shortcut is exposed to VBA. But you could simply change your caption to include the shortcut: ..Caption = "Create an import File Ctrl-P" HTH, Bernie Excel MVP "Douvid" wrote in message ... and where do I have to declare it ? It still doesn't appear in the menu ? But I'm getting close Cheers, Douvid -----Original Message----- Douvid, If by shortcut you mean a CTRL+key combination, then Application.MacroOptions _ Macro:= ThisWorkbook.Name & "!outils.importfile", _ ShortcutKey:="p" for example. HTH, Bernie Excel MVP "Douvid" wrote in message ... HI, in the following code I create a custom menu but I would like to have the shortcut to be set for the button and written in the menu. I can't find where to put them ? Can someone advise, thanks a lot Dim cbar As Office.CommandBar Dim monoutil As CommandBarControl Dim menu1, cbctl1, cbctl2, cbctl3, cbctl4 As CommandBarControl Dim sub1, sub2, sub3 As CommandBarButton 'create a control popup on the main Worksheet menu bar Set monoutil = Application.CommandBars("worksheet menu bar").Controls.Add(Type:=msoControlPopup) monoutil.Caption = "&Sbops-Tool 1.0" monoutil.Visible = True 'add a menu item Set cbctl1 = monoutil.Controls.Add (Type:=msoControlButton) With cbctl1 .Visible = True .Style = msoButtonIconAndCaption .Caption = "Create an import File" ' is required for caption .OnAction = ThisWorkbook.Name & "! outils.importfile" 'action to perform .FaceId = 2670 End With . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet Shortcut Menu | Excel Discussion (Misc queries) | |||
What is a shortcut menu? | Excel Discussion (Misc queries) | |||
Popup Menu / Shortcut Menu | Excel Discussion (Misc queries) | |||
Alt Shortcut from right-click menu | Excel Discussion (Misc queries) | |||
shortcut menu | Excel Discussion (Misc queries) |