Thread: [Solved] list of Opened excel files
View Single Post
 
Old 04-13-2011, 03:59 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi SDondeti,

Try something along the lines of:
Code:
Sub ListOpenExcelFiles()
Dim ObjXL As Object, xlWkBk, StrWkBks As String
' Test to see if there is a copy of Microsoft Excel already running.
On Error Resume Next
Set ObjXL = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
  MsgBox "No Excel Files are open (Excel is not running)"
  Exit Sub
End If
For Each xlWkBk In ObjXL.Workbooks
  StrWkBks = StrWkBks & vbCr & xlWkBk.Name
Next
MsgBox "The following Excel Files are open:" & StrWkBks
Set ObjXL = Nothing
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote