View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Search through subfolders

I came up with this using Application.FileSearch
Sub FindFiles()
Dim i As Long
With Application.FileSearch
.SearchSubFolders = True
.LookIn = "C:\"
.Filename = "*.txt"
.FileType = msoFileTypeAllFiles
.Execute
For i = 1 To .FoundFiles.Count
Range("A" & i) = .FoundFiles(i)
Next
End With
End Sub

I also found this on Ron De Bruin's site:
http://www.rondebruin.nl/copy33.htm

Charles

JustinP wrote:
Given a parent folder, I need to be able to search through subfolders
looking for files with the extension ".mxd" and write the name of those
files to an excel spreadsheet.

Can anyone point me in the direction of any parts of this problem being
done elsewhere? (or tell me how its done?)