ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add submenu to custom menu (https://www.excelbanter.com/excel-programming/272406-add-submenu-custom-menu.html)

Excel[_3_]

Add submenu to custom menu
 
I have a custom menu on the menu bar. There are 2 menus. I want to
add a sub menu as follows:

Test Analyses
Explore Test
Type 1 -- call sub1
Type 2 -- call sub2
Plan Test -- call sub3


Here is the code so far:
Set newmen = MenuBars(xlWorksheet).Menus.Add("Test &Analyses")
newmen.MenuItems.Add "E&xplore Test", "getEXPLOREdata"
newmen.MenuItems.Add "&Plan Test", "getPLANdata"


Thanks

john Dijkman

Add submenu to custom menu
 
try this... John

Sub CreateMenu()
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuItem As CommandBarControl
Dim Submenuitem As CommandBarButton

Call DeleteMenu

Set NewMenu = CommandBars(1).Controls.Add _
(Type:=msoControlPopup, _
temporary:=True)

NewMenu.Caption = "&Budgeting"

Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlPopup)
With MenuItem
.Caption = "&Submenus"
.BeginGroup = True
End With

Set Submenuitem = MenuItem.Controls.Add _
(Type:=msoControlButton)
With Submenuitem
.Caption = "Sub &1"
.OnAction = "Macro1"
End With

Set Submenuitem = MenuItem.Controls.Add _
(Type:=msoControlButton)
With Submenuitem
.Caption = "Sub &2"
.OnAction = "Macro2"
End With
End Sub




-----Original Message-----
I have a custom menu on the menu bar. There are 2

menus. I want to
add a sub menu as follows:

Test Analyses
Explore Test
Type 1 -- call sub1
Type 2 -- call sub2
Plan Test -- call sub3


Here is the code so far:
Set newmen = MenuBars(xlWorksheet).Menus.Add("Test

&Analyses")
newmen.MenuItems.Add "E&xplore Test", "getEXPLOREdata"
newmen.MenuItems.Add "&Plan Test", "getPLANdata"


Thanks
.



All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com