Hello All!
I know this one is solved, but I didn't want to start a whole new thread for the same issue (pretty close).
I used the code above with a tweak to populate a listbox, but it is only picking up 1 open excel file. it is not doing each.
here is my code:
Code:
Public Sub UserForm_Initialize()
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
filelist.AddItem ("No Excel Files are open (Excel is not running)")
Exit Sub
End If
For Each xlWkBk In ObjXL.Workbooks
filelist.AddItem xlWkBk.Name
Next xlWkBk
Set ObjXL = Nothing
End Sub
does anyone know where I am going wrong on this one?