+ Reply to Thread
Results 1 to 3 of 3

Check if several workbooks are open

  1. #1
    Ricardo Silva
    Guest

    Check if several workbooks are open

    Hi,
    I want to check if a list of workbooks are open and if not open them.
    Could someone help me?


  2. #2
    Eric White
    Guest

    RE: Check if several workbooks are open

    On the fly:

    Dim WorkbookNames() as Variant
    Dim wb as Workbook
    Dim i as Integer

    WorkbookNames = array("Workbook1.xls", "Workbook2.xls", "Worbook3.xls")

    For i = 0 to Ubound(WorkbookNames)
    On Error Resume Next
    Set wb = Workbooks(WorkbookNames(i))
    If wb Is Nothing Then
    Workbooks.Open WorkbookNames(i)
    End If
    Next i
    On Error Goto 0

    Set wb = Nothing



    "Ricardo Silva" wrote:

    > Hi,
    > I want to check if a list of workbooks are open and if not open them.
    > Could someone help me?
    >


  3. #3
    Ricardo Silva
    Guest

    RE: Check if several workbooks are open

    HI Eric,
    Thanks for the tip; however this routine is constantly open the array that
    is defined Some workbooks have links and they were previously open I receive
    a message that Reopening the workbook will discard all changes done. Is there
    a way to avoid reopening it?
    In the other hand can the array be = to all files linked to the active
    workbook?
    Thanks for you help.
    Ricardo

    "Eric White" wrote:

    > On the fly:
    >
    > Dim WorkbookNames() as Variant
    > Dim wb as Workbook
    > Dim i as Integer
    >
    > WorkbookNames = array("Workbook1.xls", "Workbook2.xls", "Worbook3.xls")
    >
    > For i = 0 to Ubound(WorkbookNames)
    > On Error Resume Next
    > Set wb = Workbooks(WorkbookNames(i))
    > If wb Is Nothing Then
    > Workbooks.Open WorkbookNames(i)
    > End If
    > Next i
    > On Error Goto 0
    >
    > Set wb = Nothing
    >
    >
    >
    > "Ricardo Silva" wrote:
    >
    > > Hi,
    > > I want to check if a list of workbooks are open and if not open them.
    > > Could someone help me?
    > >


+ 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