Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning Macros to Toolbar buttons JMay Excel Discussion (Misc queries) 1 July 24th 07 07:22 PM
Assigning Macros to Buttons Christine Excel Discussion (Misc queries) 1 May 11th 06 09:42 PM
Assigning Macros to Buttons in Excel Ronnie Excel Worksheet Functions 2 July 20th 05 08:43 PM
assigning macros to buttons or autoshapes John of the new year Excel Worksheet Functions 1 June 10th 05 01:31 AM
assigning macros to several custom buttons Greg Wilson[_3_] Excel Programming 0 August 12th 03 11:52 PM


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"