Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Dynamic menus

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Dynamic menus

That was accually a better way of doing it then the way i tought of, but is
there a way to automaticly load the menu when you open the excel document?

"Bob Phillips" wrote:

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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Dynamic menus


Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars(1).Controls("Weeks").Delet e
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars(1).Controls("Weeks").Delet e
On Error GoTo 0

Call AddMenu
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tobie" wrote in message
...
That was accually a better way of doing it then the way i tought of, but

is
there a way to automaticly load the menu when you open the excel document?

"Bob Phillips" wrote:

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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub-menus of main menus for Excel 2007 Eleanor Peppard New Users to Excel 1 March 16th 10 04:12 PM
Dynamic drop-down menus with PivotCharts [email protected] Charts and Charting in Excel 6 August 21st 08 01:17 AM
difference between word 2003 menus and word 2007 menus-Explain pl kali Excel Discussion (Misc queries) 1 August 29th 07 07:56 AM
New Menus - attaching but menus are reset Greegan Excel Worksheet Functions 0 November 5th 05 03:19 PM
Overriding Actions of Excel DropDown Menus and Poup Menus Von Shean Excel Programming 2 February 3rd 04 06:43 AM


All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"