Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I delete my custom button on closing
Hello everyone
I use the following code to create a button and run a macro - the problem is how do I delete it when I close the workbook Any Ideas Kenny I am using Sub MyButton() Set MenuItem = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:= _ msoControlButton) With MenuItem .FaceId = 277 .OnAction = "MyPass" End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I delete my custom button on closing
Hi Kenny,
Change: Set MenuItem = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:= _ msoControlButton) to Set MenuItem = Application.CommandBars("Worksheet Menu Bar") _ .Controls.Add(Type:=msoControlButton, Temporary:=True) Temporary controls are automatically deleted when Excel is closed. --- Regards, Norman "N E Body" wrote in message ... Hello everyone I use the following code to create a button and run a macro - the problem is how do I delete it when I close the workbook Any Ideas Kenny I am using Sub MyButton() Set MenuItem = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:= _ msoControlButton) With MenuItem .FaceId = 277 .OnAction = "MyPass" End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2003 - 2007 custom macro and custom button restore. | Excel Discussion (Misc queries) | |||
Delete a custom button by holding down the ALT key and dragging the button off the toolbar | Excel Programming | |||
Can't delete custom button and toolbar | Excel Programming | |||
Closing a workbook by a button only | Excel Programming |