+ Reply to Thread
Results 1 to 5 of 5

Test if Workbook Open

  1. #1
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Test if Workbook Open

    Just a quickie. I'm rusty and can't find this in Excel's Help.

    How do I test to see if a workbook of a given name is open in my Windows session?
    Last edited by ffffloyd; 04-14-2009 at 02:03 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Test if Workbook Open

    Hi Floyd,

    The following code will check if another workbook is open IN THE SAME Excel instance (different window, but only one excel.exe running). If you open a second Excel instance it will not be checked by this code.
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Re: Test if Workbook Open

    Thanks Paul. So there's no way of doing it without triggering an error if the workbook isn't open? It's just that I already have an ON ERROR operating and would prefer not to have to fiddle around with it if possible.
    Last edited by ffffloyd; 04-14-2009 at 01:00 AM. Reason: clarification

  4. #4
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Re: Test if Workbook Open

    D'OH! I can just step through the Workbooks collection, can't I, testing each name to see if it matches the one I want? It probably isn't as sophisticated as your code, Paul, but I reckon that'll do what I want.

    No worries, I seem to have answered my own question. Thanks for your help though.

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

    Re: Test if Workbook Open

    Here's a User Defined Function (UDF) that tests if a workbook is open
    Please Login or Register  to view this content.
    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)

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