+ Reply to Thread
Results 1 to 3 of 3

Refer to Macro Workbook that name keeps changing

  1. #1
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Refer to Macro Workbook that name keeps changing

    The workbook I have a macro in may be saved under a new name. How can I reword this and just refer to this as this work book instead of by name. The current name is "Combined Flow.xlsm", so the macro works, but it wont work if its save as something else.



    HTML Code: 

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,628

    Re: Refer to Macro Workbook that name keeps changing

    For instance:
    instead of:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    PS. As you see ThisWorkbook is not equivalent of activeworkbook - Thisworkbook it is the one, where macro resides.

    Another possibility:

    Please Login or Register  to view this content.
    this will store reference to active (at this moment) workbook in a variable and when needed "reactivate" it.
    Last edited by Kaper; 01-20-2014 at 08:44 AM.

  3. #3
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Refer to Macro Workbook that name keeps changing

    Awesome. Worked great. Thanks

+ 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. How to get Pivot Table Macro to refer to current workbook.
    By shabbir9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2014, 01:41 PM
  2. Macro to Refer the current Workbook for opening PPT Template
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2013, 05:25 AM
  3. [SOLVED] How to refer to the workbook where the macro when another workbook is open during runtime?
    By jonelamora in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 11:21 PM
  4. [SOLVED] Macro to copy data to a workbook from another workbook with a changing file name
    By gruittbm in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-11-2012, 05:28 PM
  5. When writing a macro in excel workbook, how do I refer to ea cell
    By Diana Bartz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2005, 05:05 PM

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