Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning Macros to Toolbar buttons
When a file containing a macro is saved using 'save as' under a new name the
toolbar buttons are modified...the assign macro setting is changed to the new name. Is there a way to programatically change the assignment? If not, do you have any suggestions on how to distribute a VBA application, where the functions are made easily accessible through a custom toolbar, without the risk of the assignment getting modified? Thanks in advance, -- VBA Fun |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning Macros to Toolbar buttons
My preference is to programmatically create the toolbar on WB_Open and to set
its Temporary property to True in order to avoid having to delete it on WB_BeforeClose. However, I believe the standard is to have code delete it. I also prefer to make it invisible on WB_Deactivate and visible again on WB_Activate in order to avoid having it available if the user switches between WB's without closing the former. Else errors may be gernerated if the buttons get clicked while an inappropriate WB is active. This method in affect makes custom TB's workbook based instead of application based. To my knowledge, TB customizations reside on the drive in which they were created (e.g. Excel.xlb) which leads to no end of pain in an intranet environment. If the WB is saved using 'save as' then closing and reopening the original will solve the problem. Typically I assign the macro names, captions and tool tips to separate arrays. I create the tool bar using a loop and apply the above by referencing the array index values. Regards, Greg Wilson "VBA Fun" wrote: When a file containing a macro is saved using 'save as' under a new name the toolbar buttons are modified...the assign macro setting is changed to the new name. Is there a way to programatically change the assignment? If not, do you have any suggestions on how to distribute a VBA application, where the functions are made easily accessible through a custom toolbar, without the risk of the assignment getting modified? Thanks in advance, -- VBA Fun |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning Macros to Toolbar buttons
Just to add:
commandbars("Custom1").Controls("MyControl").OnAct ion = "MyWorkbook.xls!MyMacro" -- Regards, Tom Ogilvy "VBA Fun" .(donotspam) wrote in message ... When a file containing a macro is saved using 'save as' under a new name the toolbar buttons are modified...the assign macro setting is changed to the new name. Is there a way to programatically change the assignment? If not, do you have any suggestions on how to distribute a VBA application, where the functions are made easily accessible through a custom toolbar, without the risk of the assignment getting modified? Thanks in advance, -- VBA Fun |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Assigning Macros to Toolbar buttons | Excel Discussion (Misc queries) | |||
Assigning Macros to Buttons | Excel Discussion (Misc queries) | |||
Assigning Macros to Buttons in Excel | Excel Worksheet Functions | |||
assigning macros to buttons or autoshapes | Excel Worksheet Functions | |||
assigning macros to several custom buttons | Excel Programming |