Get sheets name without file open
Thanks,
but it still open files (with hiden option) so it takes many time to make it
with many files. And on end of loop this file must be closed (I can writhe
this myself).
But becouse it probably only this way to get this data I use it in my macro.
Thanks again,
Bartosz
"Joel" wrote:
I was looking a the wrong workbooks. Make this change
from
For Each Sht In Sheets
to
For Each Sht In obj.Sheets
"Joel" wrote:
See if this runs quicker
Sub test()
Folder = "c:\temp\"
FName = Dir(Folder & "*.xls")
RowCount = 1
Do While FName < ""
Set obj = GetObject(Folder & FName)
For Each Sht In Sheets
Range("A" & RowCount) = FName
Range("B" & RowCount) = Sht.Name
RowCount = RowCount + 1
Next Sht
Set obj = Nothing
FName = Dir()
Loop
End Sub
|