Hi - I've been racking my brain with this one and tried a million different things but just can't get it sorted. I have 2 popup menu items, that I want shown in the main menu. However it only shows one in the main menu and then the other is shown in the first popup. What am I missing?? thanks!
Code:
Sub CustomMenu()
Dim iMenu As CommandBarControl
Dim iMenuBar As CommandBar
Dim iHelpMenu As Integer
Dim iCustomMenu As CommandBarControl
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Menu").Delete
On Error GoTo 0
Set iMenuBar = Application.CommandBars("Worksheet Menu Bar")
iHelpMenu = iMenuBar.Controls("Help").Index
Set iCustomMenu = iMenuBar.Controls.Add(Type:=msoControlPopup, Before:=iHelpMenu)
With iCustomMenu
.Caption = "Menu"
Set iCustomMenu = iCustomMenu.Controls.Add(Type:=msoControlPopup)
With iCustomMenu
.Caption = "Soup"
.BeginGroup = True
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Chowder"
.OnAction = "NewEngland"
.Enabled = True
.FaceId = 1
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Stew"
.OnAction = "Irish"
.Enabled = True
.FaceId = 2
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Escarole"
.OnAction = "Italt"
.Enabled = True
.FaceId = 3
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "French Onion"
.OnAction = "France"
.Enabled = True
.FaceId = 4
End With
End With
Set iCustomMenu = iCustomMenu.Controls.Add(Type:=msoControlPopup)
With iCustomMenu
.Caption = "Salad"
.BeginGroup = True
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Caesar"
.OnAction = "Mexico"
.Enabled = True
.FaceId = 1
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Wedge"
.OnAction = "Jersey"
.Enabled = True
.FaceId = 2
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Southwest"
.OnAction = "Arizona"
.Enabled = True
.FaceId = 3
End With
With iCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Kale"
.OnAction = "California"
.Enabled = True
.FaceId = 4
End With
End With
End With
End Sub