View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips[_4_] Bob Phillips[_4_] is offline
external usenet poster
 
Posts: 834
Default Menus in xlmenubar

You have got the right way to nest the menus. I would just suggest better
indentation to make it more readable

Dim idx As Long

idx = Application.CommandBars.FindControl(ID:=30010).Ind ex
With Application.CommandBars(1).Controls.Add( _
Type:=msoControlPopup, _
befo=idx)

.Caption = "&Menu1"

With .Controls.Add(Type:=msoControlButton)

.Caption = "name1"
.OnAction = "Test"
End With

With .Controls.Add(Type:=msoControlButton)

.Caption = "name2"
.OnAction = "Test"
End With

With .Controls.Add(Type:=msoControlPopup)

.Caption = "menu2"

With .Controls.Add(Type:=msoControlButton)

.Caption = "name3"
.OnAction = "Test"
End With
End With
End With

--

HTH

Bob

"Steve davis" wrote in message
...

hi thanks 4 the help had a play a first with no success but got it ight
later this is the new one


Dim idx As Long

idx = Application.CommandBars.FindControl(ID:=30010).Ind ex
With Application.CommandBars(1).Controls.Add(Type:=msoC ontrolPopup,
befo=idx)

.Caption = "&Menu1"

With .Controls.Add(Type:=msoControlButton)
.Caption = "name1"
.OnAction = "Test"

End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "name2"
.OnAction = "Test"

End With

With .Controls.Add(Type:=msoControlPopup)
.Caption = "menu2"

With .Controls.Add(Type:=msoControlButton)
.Caption = "name3"
.OnAction = "Test"
End With
End With
End With
End Sub


with the old xlmenubar option i could add more than one caption between my
end with command.
but when i put name1 and name2 in the same end with only name2 was showing
so did it this way thanks 4 your help its put me on the right track now