Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Macros don't work when file name changes

I created a workbook with many macros using the simple "record macro" tool.
This fiel was saved in *.XLS format. It is intended to be a master fille and
when you fill it out as a form you re-save it with a new name.

the problem I am running into is that after I re-save it wit a new name the
Macros won't work properly. I get an error message and when I click to run
the debugger the macro lists the original workbook name.

How do I fix this so that the macros work regardless of file name?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Macros don't work when file name changes

Without seeing the code, my guess is that the macro recorder put
explicit file names in the code, e.g., Windows("Book1.xls").Activate.
You need to modify the code so that it will reference the
ActiveWorkbook instead of a specific named workbook.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]




On Wed, 13 Jan 2010 09:31:01 -0800, Chuck Sena <Chuck
wrote:

I created a workbook with many macros using the simple "record macro" tool.
This fiel was saved in *.XLS format. It is intended to be a master fille and
when you fill it out as a form you re-save it with a new name.

the problem I am running into is that after I re-save it wit a new name the
Macros won't work properly. I get an error message and when I click to run
the debugger the macro lists the original workbook name.

How do I fix this so that the macros work regardless of file name?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macros don't work when file name changes

It could depend on how you run the macro--or what object you assigned the macro
to so that you could run it.

On the other hand, it could depend on how the code is written.

If it's the first, then you'll have to share what you use to run the macro--a
shape placed on a worksheet or a button on a toolbar/QAT/Ribbon.

If it's a button on a worksheet, did you use the button from the Forms toolbar
or a Commandbutton from the control toolbox toolbar.

Does it run ok if you use Tools|Macro|macro|run (in xl2003 menus).

If it's the second, then maybe just rewriting the offending code to use the
activesheet would fix it.

But those are just guesses.

You'll get better answers if you supply more info--and if it's the code, you'll
get better answers if you share the code--and indicate what line caused the
trouble.



Chuck Sena wrote:

I created a workbook with many macros using the simple "record macro" tool.
This fiel was saved in *.XLS format. It is intended to be a master fille and
when you fill it out as a form you re-save it with a new name.

the problem I am running into is that after I re-save it wit a new name the
Macros won't work properly. I get an error message and when I click to run
the debugger the macro lists the original workbook name.

How do I fix this so that the macros work regardless of file name?


--

Dave Peterson
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
Macros do not work anymore! fak119 Excel Discussion (Misc queries) 4 September 28th 09 05:54 PM
PC macros won't work on MAC Adam Excel Discussion (Misc queries) 2 April 21st 08 01:58 PM
how do i use macros to work out commissions cheltthai Excel Worksheet Functions 2 March 29th 07 10:50 PM
Solver does not work from Macros mjd918 Setting up and Configuration of Excel 1 January 6th 06 04:15 PM


All times are GMT +1. The time now is 12:44 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"