+ Reply to Thread
Results 1 to 6 of 6

Macro doesn't work when workbook is renamed

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    24

    Macro doesn't work when workbook is renamed

    I have a worksheet that has a button, which runs a macro that copies certain information into another workbook. The macro is saved in the workbook, because it will be used by 5 different people. When the workbook is opened it is renamed so the orginal stays empty for the next person. But, after it is renamed, the macro will not work. Is there a way to make the macro work no matter what the file name is?
    I am using Excel 2010

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Macro doesn't work when workbook is renamed

    We'll need to see the code. It's probably a simple tweak but can't do it blindly.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    07-28-2009
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Macro doesn't work when workbook is renamed

    Please Login or Register  to view this content.
    Last edited by Cutter; 07-23-2012 at 02:43 PM. Reason: Added code tags

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Macro doesn't work when workbook is renamed

    Please use code tags around your code as it makes it easier to read.

    I am thinking that the code is in a workbook named TEST - QUOTE SHEET.xlsm. If so, change all the lines with:

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Now having said that, this code should be cleaned up. You don't need to activate workbooks back and forth. If this is of interest to you, then you can start a new thread asking for help on cleaning up the code and making it more efficient.

  5. #5
    Registered User
    Join Date
    07-28-2009
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Macro doesn't work when workbook is renamed

    Thank you, I will make the change and see if that corrects my problem. I'm sorry, but I don't know what code tags are. I am self taught and know just enough to be dangerous. I appreciate your help and I will submit another thread to clean up the code. Thanks a million.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Macro doesn't work when workbook is renamed

    Code tags are available on the 'Go Advanced' pane or you can manually put them in by putting [CODE] ... [/CODE?] around your code. (just remove the question mark I put in to prevent it from recognizing the Code tags)

    If you your problem is solved then please mark the thread as Solved (under Thread Tools or Advanced Pane >> First post >> change the prefix).

    Good luck.

    abousetta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1