View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default make a list of files in a directory

from Excel help

Set fs = Application.FileSearch
With fs
.LookIn = "C:\Documents and Settings\rdrummon\Desktop"
.SearchSubFolders = True
.Filename = "cmd*"
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

this example searches for all files starting with cmd, take out the line
..Filename = "cmd*"
to search for all files.

Hope this helps
Rowan


"GFN" wrote:

Is there a way for excel to list the files in a directory including
subdirectories.