Results 1 to 6 of 6

Thread: Get Name List of All Open Workbook Files

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    If you to check if a particular file you are looking for is currently open, use this function

    Code:
    Function IsBookOpen(strNameOfFile As String) As Boolean
        Dim wbk As Workbook
        
        For Each wbk In Application.Workbooks
            If InStr(1, wbk.Name, strNameOfFile) Then
                IsBookOpen = True: Exit For
            End If
        Next wbk
        
    End Function
    and call it like this

    Code:
    IsBookOpen "MyBook.xlsx"
    If you want a list of all open workbooks, try modifying by taking out the if condition and printing out the names of each workbook like for example
    Code:
    Msgbox wbk.Name
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Member
    Join Date
    Nov 2011
    Posts
    41
    Rep Power
    0
    Thanks to all for their reply, the last reply is exactly same , i was looking for.

Similar Threads

  1. Open And Activate Workbook Before Runing Macro
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 06-04-2013, 07:23 PM
  2. VBA Code to Open Workbook and copy data
    By Howardc in forum Excel Help
    Replies: 16
    Last Post: 08-15-2012, 06:58 PM
  3. Replies: 8
    Last Post: 08-05-2012, 10:07 AM
  4. Assign an event to chart on workbook open
    By LalitPandey87 in forum Excel Help
    Replies: 2
    Last Post: 02-20-2012, 07:43 AM
  5. List Of All Files In A Folder
    By Excel Fox in forum Excel Help
    Replies: 2
    Last Post: 10-27-2011, 09:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •