View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Directory List of Excel Files

My opologees for not being clear. I will have a summary
spreadsheet open, that will be gathering data from 400
excel files, each of which will have an unknown number of
worksheets (but each sheet will be identical in the
layout). I need to open 1 excel file at a time (your
code you pointed to me early does that!) then I need to
get a list of worksheet names from that workbook and use
that info in the other workbook I have open (name
summary.xls).

I can not figure this out as I will also have summary.xls
open and I will be opening and closing all the workbooks
one at a time to extact the data.


-----Original Message-----
Try this

Sub test2()
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "c:\Data"
.SearchSubFolders = False
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file

(s) found."
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = .FoundFiles(i)
Cells(i, 2).Value = FileDateTime(.FoundFiles

(i))
Cells(i, 3).Value = FileLen(.FoundFiles(i))
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message

...
What you have is great! But I will only need the list

of
worksheets from each workbook. Can you provide some
assistance on that ???

-----Original Message-----
Try to understand this example
http://www.rondebruin.nl/copy3.htm

Post back if you need help

--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message

...
Is there a way, through VB, to get a list of excel

files
from a folder and loop through that list???

I am looking at the "Directory" command but can not
figure out the syntax, and I don't think it can do

want I
need anyway!

Any help would be great!!!


.



.