filesearch not finding files

G

Guest

I have just reinstalled my development tools (Visual Studio .net and VS for
Office 2003) and my code for FileSearch is no longer finding files. The code
is as follows

Dim fs As FileSearch

Dim strFile As String

' Declare filesearch object.
Set fs = Application.FileSearch
With fs
.NewSearch
.SearchSubFolders = False

' Set folder to search.
.LookIn = strDir

' Set file name to search for.
.FileName = "*.*"
lngCount = 0

' Execute the file search, and check to see if the file(s) are
' present.
If .Execute > 0 Then
Me.lstFiles.Value = ""
' Loop through all found file names and fill the list box.
For intLoop = 1 To .FoundFiles.Count
strFile = .FoundFiles(intLoop)
strFile = Check_If_PDF(strFile)
If strFile = "" Then
Else
Me.lstFiles.AddItem strFile
lngCount = lngCount + 1
End If
Next intLoop
End If
End With

When I run this code on another machine it works fine. The above code is a
standard I use on Access and Excel and whilst the folders I am searching
contain files that should be returned, the code says there is nothing.

Any ideas or is this a new bug.
 
G

Guest

Having just dug further into the questions posed on this site, it seems that
FileSearch is considered a problem.

If anyone has any idea of why FileSearch should stop working, I would be
interested, otherwise no problem.

I will go with some of the other solutions shown here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top