+ Reply to Thread
Results 1 to 7 of 7

How to activate a new workbook after save as

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    How to activate a new workbook after save as

    Hello All,
    Please help me how to activate the wbNew after save the current wbtarget to wbNew:

    I'm using the below code but it's not working.
    Please Login or Register  to view this content.
    Regards,
    tt3
    Last edited by tuongtu3; 06-10-2013 at 02:32 AM. Reason: Solved

  2. #2
    Registered User
    Join Date
    11-27-2012
    Location
    Alabama
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: How to activate a new workbook after save as

    The active workbook will be the new workbook. Try the following code. wbTarget was not defined so i changed your code slightly.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to activate a new workbook after save as

    Hi Bill,
    I got Run-time error '438' Object doesn't support this property or method at this line
    HTML Code: 
    Regards,
    tt3

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to activate a new workbook after save as

    Quote Originally Posted by tuongtu3 View Post
    Hello All,
    Please help me how to activate the wbNew after save the current wbtarget to wbNew:

    I'm using the below code but it's not working.
    Please Login or Register  to view this content.
    Regards,
    tt3
    Replace your code with just this...

    Please Login or Register  to view this content.
    Note that its the filename that changes and not the open workbook.
    The Active workbook is now a workbook with a new filename.
    The old file will remain unchanged.
    The variable wbTarget is the same open workbook with a new filename
    I hope that makes sense.

    Also note you were missing a colon in the file path.
    Last edited by AlphaFrog; 06-10-2013 at 01:32 AM.

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to activate a new workbook after save as

    Hi ALpha,
    I tried your code and put below code after yours but it does not work.
    Please Login or Register  to view this content.
    Regards,
    tt3

    Updated:
    Sorry ALpha, your code works fine and thank you very much for your help.
    How to get the new file name on range H2? The below code does not work.
    And how to Save and closed this new wb?

    Please Login or Register  to view this content.
    Regards,
    tt3
    Last edited by tuongtu3; 06-10-2013 at 02:07 AM.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to activate a new workbook after save as

    Sheets("Sheet1").Range("H2").Value = wbTarget.Name

    I don't know if ThisWorkbook and wbTarget are the same workbooks. They may or may not be.
    ThisWorkbook is the workbook that contains the macro code regardless of which workbook is active.
    Last edited by AlphaFrog; 06-10-2013 at 02:24 AM.

  7. #7
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to activate a new workbook after save as

    Hi Alpha,
    Yes, the code works perfect and thank you very much for your help.

    Regards,
    tt3

+ 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