View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default FileSearch does not work, XP SVP1, Office 2002

FileSearch is problematic. It doesn't work for me, either; same program
versions that you are using.

On Thu, 18 Nov 2004 11:09:55 -0800, "wejones"
wrote:

I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
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