Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's some code I wrote based on the links Tom provided. I've got exactly
the same issue as you. You should be able to copy this into your .xla module. The user would have to manually run the "AddMenuButton" macro using the Tools...Macro menu item. (The macro won't show up in the list, but the macro can still be run.) You could probably trigger an automatic load using the tips provided by Randy. ======================= Sub AddMenuButton() 'Creates a command button on the Standard toolbar Dim mCaption As String Dim objCommandBar As Office.CommandBar Dim objCommandBarControl As Office.CommandBarControl Dim objCommandBarButton As Office.CommandBarButton mCaption = "Button Text" Set objCommandBar = Application.CommandBars("Standard") For Each objCommandBarControl In Application.CommandBars("Standard").Controls If objCommandBarControl.Caption = mCaption Then objCommandBarControl.Delete Next objCommandBarControl With objCommandBar.Controls Set objCommandBarButton = .Add(msoControlButton) With objCommandBarButton .Caption = mCaption .Style = msoButtonCaption .TooltipText = "Bring up the CPS PV Export control form" .OnAction = "DisplayForm" End With End With End Sub |