Assigned macro change
Joel
I wasn't clear. I have a workbook A.xls with macros and buttons to
execute the macros. With VBA I do a SaveAs and name it B.xls. A.xls is now
closed. I click a button in B.xls. I get an error because VBA is looking
for A.xls!MacroName. I want the macro that is assigned to a button in B.xls
to be a macro that is in WB B.xls. Otto
"Joel" wrote in message
...
To reference the workbook with the macro make the following change
from
workbooks("A.xls")
to
ThisWorkbook
"Otto Moehrbach" wrote:
Excel XP & Win XP
Everything below is done via VBA.
I have a workbook, say A.xls, that has a number of macros and a number of
buttons here and there to trigger the macros. All the macros assigned to
the buttons are in that workbook.
I do some work with this workbook.
Then I SaveAs as B.xls.
In the B.xls workbook, the macro assignments all reference A.xls as the
location of the macros.
I want the macro assignments in B.xls to reference B.xls.
Is there some code that I can employ at the time of the SaveAs to carry
the
macro assignments to the new workbook?
If not, what would be the best way to change the macro assignments to
B.xls
after B.xls is created?
Thanks for your time. Otto
|