MrExcel Publishing
Your One Stop for Excel Tips & Solutions

macro assignment to custom toolbar button


Posted by Trevor Howard on July 26, 2001 12:08 PM

I have created a custom toolbar within Excel, and have assigned macros
that are associated with this same Excel file to the buttons. However,
when I either resave this file with a new name or copy this file to a new
name, the toolbar button assignments within the original file are updated
to reference the new file. Therefore, when I open the original file
later, it has to open up the new file to reference the macros within that
file, even though these same macros are also still associated with the
original file being opened. Is there any way to stop this toolbar
reference change from happening? Thanks for any help you can provide.


Posted by Jerid on July 26, 2001 1:27 PM

Hi Trevor

Can you provide a sample of the code you are using to assign the macros to the buttons?

Jerid

Posted by Trevor Howard on July 26, 2001 1:53 PM

=======

Hi Jerid.

The macro code I have is very simple. An example is as follows:

Sub Accumulation()
ActiveCell.FormulaR1C1 = "Accumulation"
ActiveCell.Offset(0, 1).Range("A1").Select
End Sub

This code is in the original Excel file, and a button on a custom toolbar references this code. When I save this Excel file as a new name, the custom toolbar buttons in the original file then tries to reference the same macros within the new file. I would like for the custom toolbar buttons in the original file to remain referenced to the macros within that file, and not to change.

Thanks for looking into this, and let me know if you need more info. Trevor