Creating sub menu in Command bar
Thanks for replying in the follow up of this old post... still not understand
how you get to pick all new posts or continuation of old post but you guys
have been very helpfull for me.
I did use
On Error Resume Next
CommandBars(1).Controls("Name of new bar").Delete
On Error GoTo 0
And was able to keep just one copy of it but still can not make it go away
when I close the file just go away when I close excel completely...
I have two questions...
HOW DO I DELETE IT BEFORE CLOSING THE FILE?
HOW DO I KEEP IT THERE EVEN BEFORE I CLOSE EXCEL? so it stays forever.
"Gord Dibben" wrote:
Check your other post for how to delete.
Gord Dibben MS Excel MVP
On Tue, 19 Jan 2010 16:58:01 -0800, Alberto Ast
wrote:
Not sure if someone will still see this old post... I tried for a while to
make this sample run and finaly I could but how do I delete it when closing
the file... each time a run the file it creates a new comandbar called "Name
of new bar" and I can not delete it... I got my command bar full of them....
I need to close all my excel files to get ride of it... any idea?
"Roman" wrote:
Hi Anders,
try this one:
Sub makemenewbar()
Set mynewbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
Temporary:=True)
With mynewbar
..Caption = "Name of new bar"
End With
Set button1 = mynewbar.Controls.Add(Type:=msoControlButton)
With button1
.Caption = "Button1"
.OnAction = "macro1"
End With
Set mysubmenu = mynewbar.Controls.Add(Type:=msoControlPopup)
With mysubmenu
.Caption = "Submenu1"
'.OnAction = "sheets_startuf"
End With
Set button2 = mysubmenu.Controls.Add(Type:=msoControlButton)
With button2
.Caption = "Button2 name"
.OnAction = "macro2"
End With
Set button3 = mysubmenu.Controls.Add(Type:=msoControlButton)
With button3
.Caption = "Button3 name"
.OnAction = "macro3"
End With
End Sub
.
|