Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Toolbar
I've been reading about adding custom commands/buttons/macros to a toolbar
and need some help. I would like to be able to have a macro check for a certain button on the "Standard" tool bar, and if it's not present, then add the button, and assign a macro. Your help would be greatly appreciated. I have tried it using the techniques I have seen, but obviously I am missing something. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Toolbar
Hi Josh
Delete the button first in the code before you add it with code. Something like this Sub MenuBar_Item() Call MenuBar_Item_Delete With Application.CommandBars("Standard") With .Controls.Add(Type:=msoControlButton, temporary:=True, befo=1) .Style = msoButtonCaption .Caption = "&Hi" .TooltipText = "Hi again" .OnAction = ThisWorkbook.Name & "!TestMacro1" .Tag = "MyTag1" End With End With End Sub Sub MenuBar_Item_Delete() On Error Resume Next Application.CommandBars.FindControl(Tag:="MyTag1") .Delete On Error GoTo 0 End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Josh O." wrote in message ... I've been reading about adding custom commands/buttons/macros to a toolbar and need some help. I would like to be able to have a macro check for a certain button on the "Standard" tool bar, and if it's not present, then add the button, and assign a macro. Your help would be greatly appreciated. I have tried it using the techniques I have seen, but obviously I am missing something. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
adding custom images to a button on custom toolbar | Excel Programming | |||
Custom face for custom toolbar item | Excel Programming | |||
VBA - Disappearing custom menu and custom toolbar | Excel Programming | |||
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! | Excel Programming | |||
saving toolbar buttons on custom toolbar | Excel Programming |