+ Reply to Thread
Results 1 to 3 of 3

Activating a workbook that was previously active

Hybrid View

  1. #1
    Registered User
    Join Date
    12-21-2009
    Location
    Manchester, NH
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Activating a workbook that was previously active

    Here's the problem... An Excel file is e-mailed to my company for all the credit card transactions in a given day. Because we manage many stores and each store is a different legal entity and a different fiscal year ending, I need my macro to sort the information and separate the transaction by store and by fiscal year end. I just hit my first block. I need to open a workbook off the server to grab information for a vlookup formula. I can get the workbook open, but I can't get back to the original workbook or find a way to reactivate it. Because the macro is going to be saved in the "personal" workbook, I can't use the "thisworkbook.activate" code. Also the workbook name and tab name that is emailed to me will always be different so I can't use other solutions that I've seen posted. Any Ideas?
    Last edited by TheEJM3; 12-21-2009 at 10:43 AM. Reason: Title Change

  2. #2
    Registered User
    Join Date
    12-21-2009
    Location
    Manchester, NH
    MS-Off Ver
    Excel 2007
    Posts
    2

    Solution = Alt-Tab equivalent in VB

    My appologies Dave... I'm an idiot.

    On the other hand, I found the solution:

    Application.ActiveWindow.ActivatePrevious

    This is basically automating Alt-Tab in VB

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Activating a workbook that was previously active

    You don't actually need to activate workbooks with VBA, also please wrap your code with Code tags
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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