View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default How to add menu button to exisiting menubar

This works:

Sub AddNewItem()
Dim ctlNew As CommandBarControl
Set ctlNew = CommandBars("Chart Menu Bar").Controls _
("Chart").Controls.Add(msoControlButton, , , , True)
With ctlNew
.Style = msoButtonCaption
.Caption = "MyNewItem"
.Visible = True
.OnAction = "MyNewMacro"
End With
End Sub

Sub MyNewMacro()
MsgBox "Success!"
End Sub

--

Vasant

"Mike P" wrote in message
om...
I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike