+ Reply to Thread
Results 1 to 12 of 12

How do I rename a VBA workbook and get it to work independently from the original?

  1. #1
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    How do I rename a VBA workbook and get it to work independently from the original?

    Hi everyone,

    I'm a total newbie to VBA an I've encountered a problem when renaming a VBA workbook.

    When I rename the work, I change nothing to code or to the work, I simply want to rename the workbook. The problem I have is that when I rename it, I cannot get it to work independently from the original workbook.

    For example, my VBA was written in a workbook called 'original'. I now want to change the name of this workbook to 'new'. However, when I open new workbook and the code runs, the 'original' workbook will open - I'm assuming because it is accessing the code from that.

    This is the code I have:

    Please Login or Register  to view this content.
    Any thoughts, ideas and help on how I can simply rename my workbook and get it to work independently would be greatly appreciated.

    Many thanks in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    So you are saving this book as NewBook, and its opening the OriginaBook as well?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    Hey, that's correct.

    When I change the Cell in "B14", the macros runs, but via the OriginalBook, despite the NewBook having the exact same code

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    Ok, where have you saved the macros? Can you attach an example?

  5. #5
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    The macros has been saved in the OriginalWork, which was saved on my desktop. The NewBook is simply a copy/paste version of my original, again saved on my desktop.

    I have renamed VBA workbooks in the past and there was never an issue. I think the problem now is that I am calling up modules - something which I've never done before. ..

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    If you rename the workbook, the macros being in that workbook, then it should work.

    Can you attach the wb's?

  7. #7
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    The macros has been saved in the OriginalWork, which was saved on my desktop. The NewBook is simply a copy/paste version of my original, again saved on my desktop.

    I have renamed VBA workbooks in the past and there was never an issue. I think the problem now is that I am calling up modules - something which I've never done before. ..

  8. #8
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    oops, sorry about that - ignore the last message.

    I can't seem to find the attachment link on this...I think I'm being a bit blind. How do I go about attaching workbooks in this forum?

  9. #9
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    oooo...sorry, I've seen what the problem is. The macros module's are in fact saved in the original workbook. Is there a way I can copy those modules into the copied workbork?

  10. #10
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    Actually, I'm sorry, the macros are saved in the workbook. The problem has not been solved. Any further help would be much appreciated...

  11. #11
    Registered User
    Join Date
    08-15-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    8

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    Found the fix. I had 'Application.Run "OriginalBook.xlsm'!AppearSOP"' in the copied workbook. I just had to change that to NewBook.

    Thank you anyway for the help Nathan, much appreciate it!

  12. #12
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: How do I rename a VBA workbook and get it to work independently from the original?

    No worries.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 06-28-2014, 02:26 PM
  2. Replies: 2
    Last Post: 09-04-2012, 01:19 AM
  3. How Can The Macro Rename Files When The Original File Name Changes Everday
    By np123345 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2008, 06:59 PM
  4. rename current file save and delete original
    By valve79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2006, 05:17 PM
  5. [SOLVED] Marcro does not work when original workbook is deleted
    By alley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2005, 11:05 AM

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