+ Reply to Thread
Results 1 to 4 of 4

Activate unsaved workbook from another workbook

  1. #1
    Registered User
    Join Date
    05-09-2013
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010, Excel 2013
    Posts
    2

    Activate unsaved workbook from another workbook

    Hello,

    I am trying to activate an unsaved workbook from a seperate workbook. The unsaved workbook is a report that is exported from another program into excel, I want to reference this workbook from a macro in a seperate workbook. I have tried

    Windows("Book1").Activate
    Workbooks("Book1").Activate

    I have tried Dim wb as Workbook and then assigning Book1 to be wb, same with the worksheet within book1. Every time I do this i get the subscript out of range error, which I know means I am attempting to reference something that the macro isn't finding. I am thinking this might be because the two workbooks are seperate instances of excel? If anyone has any ideas let me know! Thanks!!

    Kendra

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Activate unsaved workbook from another workbook

    Quote Originally Posted by klallen810 View Post
    I am thinking this might be because the two workbooks are seperate instances of excel?
    I think that's the reason. You cannot use a book which is opened in another instance of Excel.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Registered User
    Join Date
    11-09-2009
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Activate unsaved workbook from another workbook

    Hi klallen810

    I checked online and find a bit of standard code and have tried and tested it on Excel 2010.
    Hope this helps.

    Please Login or Register  to view this content.
    For completeness, this is how I tested it.
    • Paste the code into your saved Excel file
    • Create a new Excel blank file and do not save it (default workbook name is "Book1")
    • Run the code -> watch Book1->Sheet1->Cell(1,1) get updated with "hello there"
    Last edited by ducky_yeng; 05-16-2013 at 08:19 PM. Reason: Removed unnecessary setence about default workbook name
    Please click * if the answer was helpful.

  4. #4
    Registered User
    Join Date
    05-09-2013
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010, Excel 2013
    Posts
    2

    Re: Activate unsaved workbook from another workbook

    Works perfectly. Thanks!

+ 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