View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alberto Ast[_2_] Alberto Ast[_2_] is offline
external usenet poster
 
Posts: 181
Default Command Bar Creation

I have search on old posts on this topic and there are a lot of information
but maybe I need more basics on this... I have tried several of the options
but can not make appear any new command on my excel file command bar...

I have Excel 2002.... I copied below code from "Roman" from a post back in
2005 but not working for me.... maybe I am not loading it in the right
place... I try a module, I try in Private Sub Workbook_Open(), and try
whatever but not luck :(

Need help to create a new menu on my command bar that will work just with a
specific file...

Appreciate help

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