+ Reply to Thread
Results 1 to 8 of 8

ActiveWorkBook

  1. #1
    Pete
    Guest

    ActiveWorkBook

    Is there a Set ActiveWorkBook command available. I have 3 seperate
    workbooks open at one time, I wish to perform actions via VBA on
    different aspects of each workbook. How do I activate a specific
    workbook.

    Thanks

    Pete


  2. #2
    CLR
    Guest

    Re: ActiveWorkBook

    Workbooks("FileName.xls").Activate

    Vaya con Dios,
    Chuck, CABGx3



    "Pete" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a Set ActiveWorkBook command available. I have 3 seperate
    > workbooks open at one time, I wish to perform actions via VBA on
    > different aspects of each workbook. How do I activate a specific
    > workbook.
    >
    > Thanks
    >
    > Pete
    >




  3. #3
    Nick Hodge
    Guest

    Re: ActiveWorkBook

    Pete

    You don't need to activate anything to work on it. Set an object variable to
    the workbooks as you open them like the code below

    Sub CatchWBs()
    Dim wb1 As Workbook, wb2 As Workbook, wb3 As Workbook

    Set wb1 = Workbooks.Open("C:\Workbook1.xls")
    Set wb2 = Workbooks.Open("C:\Workbook2.xls")
    Set wb3 = Workbooks.Open("C:\Workbook3.xls")

    'Just some random things to do with each workbook
    wb1.PrintOut
    wb2.PrintPreview
    wb3.Protect

    Set wb1 = Nothing
    Set wb2 = Nothing
    Set wb3 = Nothing

    End Sub

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    [email protected]HIS

    "Pete" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a Set ActiveWorkBook command available. I have 3 seperate
    > workbooks open at one time, I wish to perform actions via VBA on
    > different aspects of each workbook. How do I activate a specific
    > workbook.
    >
    > Thanks
    >
    > Pete
    >




  4. #4
    Pete
    Guest

    Re: ActiveWorkBook

    thanks, I'll give it a try.

    Pete


  5. #5
    Registered User
    Join Date
    10-08-2013
    Location
    N. Sembilan, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: ActiveWorkBook

    Pete uve been giving it a try since 2005? U ungrateful *******

  6. #6
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    Re: ActiveWorkBook

    Quote Originally Posted by eeijas View Post
    Pete uve been giving it a try since 2005? U ungrateful *******
    eeijas, my thoughts exactly.

    Is there a way to have these posts marked as SOLVED or Expired due to time lapse?

    Cheers
    Dan

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,530

    Re: ActiveWorkBook

    Although we encourage members to marked threads as SOLVED, it is not required and not done automatically. Just because time has passed doesn't mean it is solved.

    And to eeijas, there is no need to post to an old thread to offer nothing of value and only an insult. Do not do this again. Any further activity in this thread that is not related to the topic will result in a locked thread.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: ActiveWorkBook

    I can see that this thread should have been closed some time back, but adding posts that serve NO value on a thread is both unnecessary and unwarranted. Further posts of this nature will be dealt with accordingly

    Thanks
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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