C
Chip Pearson
Try some code like the following:
Sub CreateMenuAndItem()
Dim MenuBar As Office.CommandBar
Dim TopMenu As Office.CommandBarPopup
Dim MenuItem As Office.CommandBarButton
Set MenuBar = Application.CommandBars.FindControl(ID:=30007).Parent
Set TopMenu = MenuBar.Controls.Add(Type:=msoControlPopup, temporary:=True)
TopMenu.Caption = "&My Menu"
Set MenuItem = TopMenu.Controls.Add(Type:=msoControlButton, temporary:=True)
With MenuItem
.Caption = "&Click Me"
.Style = msoButtonCaption
.OnAction = "'" & ThisWorkbook.Name & "'!MacroName"
.Tag = "SOME_TEXT_VALUE_FOR_YOUR_APP"
End With
End Sub
Sub MacroName()
MsgBox "Hello World"
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)
Sub CreateMenuAndItem()
Dim MenuBar As Office.CommandBar
Dim TopMenu As Office.CommandBarPopup
Dim MenuItem As Office.CommandBarButton
Set MenuBar = Application.CommandBars.FindControl(ID:=30007).Parent
Set TopMenu = MenuBar.Controls.Add(Type:=msoControlPopup, temporary:=True)
TopMenu.Caption = "&My Menu"
Set MenuItem = TopMenu.Controls.Add(Type:=msoControlButton, temporary:=True)
With MenuItem
.Caption = "&Click Me"
.Style = msoButtonCaption
.OnAction = "'" & ThisWorkbook.Name & "'!MacroName"
.Tag = "SOME_TEXT_VALUE_FOR_YOUR_APP"
End With
End Sub
Sub MacroName()
MsgBox "Hello World"
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)