Results 1 to 5 of 5

Thread: Excel 2013: How To Check How Many Excel Files Are Open

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    try

    Code:
        Dim appExcel    As Excel.Application
        Dim Wbk         As Excel.Workbook
        Dim lngCount    As Long
        
        On Error Resume Next
        Set appExcel = GetObject(, "Excel.Application")
        On Error GoTo 0
        
        If appExcel Is Nothing Then
            MsgBox "There are no workbooks open", vbOKOnly
            Exit Sub
        Else
            For Each Wbk In appExcel.Workbooks
                If Not Wbk.IsAddin Then
                    lngCount = lngCount + 1
                End If
            Next
            
            MsgBox "There are " & lngCount & " workbooks open", vbOKOnly
        End If
    Last edited by Admin; 06-08-2013 at 08:54 AM.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Good tutorial Excel 2013 SDK
    By Rasm in forum Excel Help
    Replies: 2
    Last Post: 04-01-2013, 01:17 AM
  2. Replies: 10
    Last Post: 12-10-2012, 11:28 PM
  3. Excel to Excel Data transfer without opening any of the files(source or target)
    By Transformer in forum Excel and VBA Tips and Tricks
    Replies: 14
    Last Post: 08-22-2012, 10:57 AM
  4. Loop and Check For Values In Entire Column in Excel
    By Jeff5019 in forum Excel Help
    Replies: 3
    Last Post: 05-01-2012, 10:34 PM
  5. Check if file is already open
    By Rasm in forum Excel Help
    Replies: 5
    Last Post: 11-24-2011, 04:55 PM

Tags for this Thread

Posting Permissions

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