LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping Maggie[_6_] Excel Discussion (Misc queries) 6 October 2nd 08 09:14 PM
Not Looping Roger Excel Discussion (Misc queries) 0 February 26th 08 05:18 PM
Looping macro RK Excel Worksheet Functions 2 December 12th 06 11:29 PM
Looping David T Excel Discussion (Misc queries) 2 August 30th 06 10:51 PM
Looping through each directory Jim Rech Excel Programming 0 July 10th 03 06:36 PM


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"