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

Did not work. This seems to be a specific problem with Office 2002 on my
machine. I have uninstalled office, used the cleanup program and reinstalled
it. But I still have the same problem.

"Ron de Bruin" wrote:

Hi wejones

Try it with

.Filename = ".txt"

If it is not working use Dir
If you want a example post back


--
Regards Ron de Bruin
http://www.rondebruin.nl


"wejones" wrote in message ...
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