Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question on "Programming a MenuBar"
So far I have been able to determine how to create a
menubar and add a number of buttons and pop-ups to it using VBA. That's all fine if all you want to do is have a few tasks that can be done via a button. Can someone send me a *simple* *clean* example of how one adds buttons and pop-ups to a pop-up that's on the menubar to form a "tree like" menu? Something like: [PopUp][[Button][Button][Button][Button] [Button ] [Button ] [Popup ]---[Button] [Button ] [PopUp]---[Button] [Button ] [Button ] [Button] [Button ] [Button ] [Button ] [PopUp ]---[PopUp]---[Button] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] And so on. Somehow, each popup has to know when a new level is starting and when one is ending. Using the "with" would seem logical but I can't find any examples that show how it would be implemented. Any and all help appreciated. David Schrader |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question on "Programming a MenuBar"
Visit
http://www.erlandsendata.no/english/...oadcommandbars Its good "David F. Schrader" wrote in message ... So far I have been able to determine how to create a menubar and add a number of buttons and pop-ups to it using VBA. That's all fine if all you want to do is have a few tasks that can be done via a button. Can someone send me a *simple* *clean* example of how one adds buttons and pop-ups to a pop-up that's on the menubar to form a "tree like" menu? Something like: [PopUp][[Button][Button][Button][Button] [Button ] [Button ] [Popup ]---[Button] [Button ] [PopUp]---[Button] [Button ] [Button ] [Button] [Button ] [Button ] [Button ] [PopUp ]---[PopUp]---[Button] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] And so on. Somehow, each popup has to know when a new level is starting and when one is ending. Using the "with" would seem logical but I can't find any examples that show how it would be implemented. Any and all help appreciated. David Schrader |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question on "Programming a MenuBar"
Const cCommandBar = "MyCommandBar"
Sub Toolbar_OFF() Dim bar As CommandBar ''' Delete the Commandbar if it already exists For Each bar In Application.CommandBars If bar.Name = cCommandBar Then bar.Delete Next End Sub Sub Toolbar_ON() Dim bar As CommandBar Toolbar_OFF Set bar = Application.CommandBars.Add(Name:=cCommandBar, Position:=msoBarTop, Temporary:=True) ''' Popup With bar.Controls.Add(Type:=msoControlPopup) .Caption = "Cards" With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Red Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 481 .Caption = "Heart" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Heart" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 482 .Caption = "Diamond" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Diamond" End With End With With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Black Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .BeginGroup = True .FaceId = 483 .Caption = "Spade" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Spade" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 484 .Caption = "Club" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Club" End With End With End With bar.Visible = True End Sub Sub Popup_Click() With Application.CommandBars.ActionControl MsgBox "You selected: " & .Parameter End With End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "David F. Schrader" wrote in message ... So far I have been able to determine how to create a menubar and add a number of buttons and pop-ups to it using VBA. That's all fine if all you want to do is have a few tasks that can be done via a button. Can someone send me a *simple* *clean* example of how one adds buttons and pop-ups to a pop-up that's on the menubar to form a "tree like" menu? Something like: [PopUp][[Button][Button][Button][Button] [Button ] [Button ] [Popup ]---[Button] [Button ] [PopUp]---[Button] [Button ] [Button ] [Button] [Button ] [Button ] [Button ] [PopUp ]---[PopUp]---[Button] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] And so on. Somehow, each popup has to know when a new level is starting and when one is ending. Using the "with" would seem logical but I can't find any examples that show how it would be implemented. Any and all help appreciated. David Schrader |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question on "Programming a MenuBar"
You might also want to take a look at John Walkenbach's Menu Maker, it
simplifies life http://www.j-walk.com/ss/excel/tips/tip53.htm -- HTH RP (remove nothere from the email address if mailing direct) "Rob van Gelder" wrote in message ... Const cCommandBar = "MyCommandBar" Sub Toolbar_OFF() Dim bar As CommandBar ''' Delete the Commandbar if it already exists For Each bar In Application.CommandBars If bar.Name = cCommandBar Then bar.Delete Next End Sub Sub Toolbar_ON() Dim bar As CommandBar Toolbar_OFF Set bar = Application.CommandBars.Add(Name:=cCommandBar, Position:=msoBarTop, Temporary:=True) ''' Popup With bar.Controls.Add(Type:=msoControlPopup) .Caption = "Cards" With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Red Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 481 .Caption = "Heart" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Heart" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 482 .Caption = "Diamond" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Diamond" End With End With With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Black Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .BeginGroup = True .FaceId = 483 .Caption = "Spade" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Spade" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 484 .Caption = "Club" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Club" End With End With End With bar.Visible = True End Sub Sub Popup_Click() With Application.CommandBars.ActionControl MsgBox "You selected: " & .Parameter End With End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "David F. Schrader" wrote in message ... So far I have been able to determine how to create a menubar and add a number of buttons and pop-ups to it using VBA. That's all fine if all you want to do is have a few tasks that can be done via a button. Can someone send me a *simple* *clean* example of how one adds buttons and pop-ups to a pop-up that's on the menubar to form a "tree like" menu? Something like: [PopUp][[Button][Button][Button][Button] [Button ] [Button ] [Popup ]---[Button] [Button ] [PopUp]---[Button] [Button ] [Button ] [Button] [Button ] [Button ] [Button ] [PopUp ]---[PopUp]---[Button] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] And so on. Somehow, each popup has to know when a new level is starting and when one is ending. Using the "with" would seem logical but I can't find any examples that show how it would be implemented. Any and all help appreciated. David Schrader |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question on "Programming a MenuBar"
To Bob, Rob, and "bimble,"
(One has to wonder why MS had to make it quite so complex to accomplish what should be what appears on the surface to be a simple task.) My thanks. I think, between all of the material that the three of you have provided - if I can swim back to the surface - I can make it work. David "Bob Phillips" wrote in message ... You might also want to take a look at John Walkenbach's Menu Maker, it simplifies life http://www.j-walk.com/ss/excel/tips/tip53.htm -- HTH RP (remove nothere from the email address if mailing direct) "Rob van Gelder" wrote in message ... Const cCommandBar = "MyCommandBar" Sub Toolbar_OFF() Dim bar As CommandBar ''' Delete the Commandbar if it already exists For Each bar In Application.CommandBars If bar.Name = cCommandBar Then bar.Delete Next End Sub Sub Toolbar_ON() Dim bar As CommandBar Toolbar_OFF Set bar = Application.CommandBars.Add(Name:=cCommandBar, Position:=msoBarTop, Temporary:=True) ''' Popup With bar.Controls.Add(Type:=msoControlPopup) .Caption = "Cards" With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Red Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 481 .Caption = "Heart" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Heart" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 482 .Caption = "Diamond" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Diamond" End With End With With .CommandBar.Controls.Add(Type:=msoControlPopup) .Caption = "Black Cards" With .CommandBar.Controls.Add(Type:=msoControlButton) .BeginGroup = True .FaceId = 483 .Caption = "Spade" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Spade" End With With .CommandBar.Controls.Add(Type:=msoControlButton) .FaceId = 484 .Caption = "Club" .OnAction = ThisWorkbook.Name & "!Popup_Click" .Parameter = "Club" End With End With End With bar.Visible = True End Sub Sub Popup_Click() With Application.CommandBars.ActionControl MsgBox "You selected: " & .Parameter End With End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "David F. Schrader" wrote in message ... So far I have been able to determine how to create a menubar and add a number of buttons and pop-ups to it using VBA. That's all fine if all you want to do is have a few tasks that can be done via a button. Can someone send me a *simple* *clean* example of how one adds buttons and pop-ups to a pop-up that's on the menubar to form a "tree like" menu? Something like: [PopUp][[Button][Button][Button][Button] [Button ] [Button ] [Popup ]---[Button] [Button ] [PopUp]---[Button] [Button ] [Button ] [Button] [Button ] [Button ] [Button ] [PopUp ]---[PopUp]---[Button] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] [Button ] And so on. Somehow, each popup has to know when a new level is starting and when one is ending. Using the "with" would seem logical but I can't find any examples that show how it would be implemented. Any and all help appreciated. David Schrader |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I make a "tab name" the "chart title"? (question on this) | Charts and Charting in Excel | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
"Disk is Full" add-on question to "Can't reset last cell" post tod | Excel Discussion (Misc queries) | |||
Programming a "Save as..." command button within Excel | Excel Discussion (Misc queries) | |||
Programming Excel "drop-down menu" functions | Excel Programming |