Looping through each directory
Sub tester2()
With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = True
.Filename = ".xls"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
Pretty much does what you describe including the find files.
You may have to use it to get a gross list, then loop the list
(.foundfiles) to cull out the substrings you want.
Regards,
Tom Ogilvy
"Steven Revell" wrote in message
...
Hi all,
I'm looking for a way to loop through all the directories
on a server and run find files (without subdirectory
searching).
I would like it to run on Excel 97 but Excel 2000 will be
fine.
So my questions is does anyone know how to run through all
the subdirectories within a directory. And, if those
directories have sub directories then go through them as
well.
thanks for any help,
Steven
|