Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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
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
Can I make a "tab name" the "chart title"? (question on this) [email protected] Charts and Charting in Excel 2 April 15th 09 06:26 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM
Programming a "Save as..." command button within Excel DavidHawes Excel Discussion (Misc queries) 2 November 13th 06 02:48 PM
Programming Excel "drop-down menu" functions DaveG. Excel Programming 3 May 25th 04 06:09 PM


All times are GMT +1. The time now is 04:48 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"