Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi everyone,
Say I have a recorded macro named "Base" and linked it to a button in a an excel workbook named ABC.xls Later, say I changed the file name to DEF.xls Now, when I click on the button to execute, I get "out of range" error and the file close! How can I make the macro name is independent of the file name; so it doesn't keep referring to the old file name? Regards, Mike |
#2
![]() |
|||
|
|||
![]()
Hi Mike
two questions, 1) where are you saving the macro - is it in the ABC workbook or in your personal workbook? - if you want the macro to be available to a number of different workbooks it needs to be in the personal macro workbook not in a specific workbook (it can be in a specific workbook, but this workbook must be open if you want to run the macro) if that's not the problem 2) could you please copy & paste the code in a reply post so that we can see where and how the filename is being used in the code Regards JulieD wrote in message oups.com... Hi everyone, Say I have a recorded macro named "Base" and linked it to a button in a an excel workbook named ABC.xls Later, say I changed the file name to DEF.xls Now, when I click on the button to execute, I get "out of range" error and the file close! How can I make the macro name is independent of the file name; so it doesn't keep referring to the old file name? Regards, Mike |
#3
![]() |
|||
|
|||
![]()
You could reassign the macro to the button each time the workbook is opened.
Or maybe just rename DEF.xls back to ABC.xls, then open ABC.xls and do a File|SaveAs (instead of using windows explorer to rename the workbook). If that doesn't work, post some more details. What kind of button? On a worksheet from the Forms toolbar? Or on a toolbar? wrote: Hi everyone, Say I have a recorded macro named "Base" and linked it to a button in a an excel workbook named ABC.xls Later, say I changed the file name to DEF.xls Now, when I click on the button to execute, I get "out of range" error and the file close! How can I make the macro name is independent of the file name; so it doesn't keep referring to the old file name? Regards, Mike -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't get simple macro to run | Excel Worksheet Functions | |||
Change Row Numbers in Formula with Macro | Excel Discussion (Misc queries) | |||
Where to stick macro to change default comment font? | Excel Discussion (Misc queries) | |||
Macro Formula revision? | Excel Worksheet Functions | |||
Macro button colour change??? | Excel Worksheet Functions |