Dynamic menus
Is this what you mean?
Private Sub AddMenu()
With Application.CommandBars(1).Controls.Add(Type:=msoC ontrolPopup,
temporary:=True)
.Caption = "Weeks"
With .Controls.Add(Type:=msoControlPopup)
.Caption = "Week1"
With .Controls.Add(Type:=msoControlButton)
.Caption = "Monday"
.OnAction = "Macro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Tuesday"
.OnAction = "Macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Wednesday"
.OnAction = "Macro3"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Thursday"
.OnAction = "Macro4"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Friday"
.OnAction = "Macro5"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Saturday"
.OnAction = "Macro6"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Sunday"
.OnAction = "Macro7"
End With
End With
With .Controls.Add(Type:=msoControlPopup)
.Caption = "Week2"
With .Controls.Add(Type:=msoControlButton)
.Caption = "Monday"
.OnAction = "Macro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Tuesday"
.OnAction = "Macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Wednesday"
.OnAction = "Macro3"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Thursday"
.OnAction = "Macro4"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Friday"
.OnAction = "Macro5"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Saturday"
.OnAction = "Macro6"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Sunday"
.OnAction = "Macro7"
End With
End With
'etc.
End With
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Tobie" wrote in message
...
Im working on a excel project where i need some kind of menu to navigate
through weeks and days. There is one excel page for each day of the week
and
all 52 weeks included in one excel document, there is also a sumary.
I need a way of doing a menu so when you click on for example week 6
Monday-Sunday for that week comes up, perferably as a "sub-menu".
Is there any way of either making a menu with VBA or macros to have a meni
come up/down for a specific week so if you have tabs or buttons for week
1-52
and you click on one of them a new menu comes forth.
|