I
Ian Lauder
I have the following FileSearch test reproducable on a
brand new Dell laptop, running Windows XP Pro (with all
patches applies as of 10/17), and Office XP Pro (with all
patches applied as of 10/17).
There are about 50 Word documents with .doc file
extensions in the "c:\temp" folder.
The following code sample finds the folder, but
regardless of how I try and tweak the FileSearch
settings, it always returns 0 files found. Searching
the folder via the command prompt/desktop shows they
exist. Are there any known problems with the FileSearch
not returning results? This happens on a number of our
clients computers and works on some of ours, however now
with this new laptop all patched up, it is a reproducable
problem.
Note, this doesn't appear to be a coding problem as the
same code snippet on another of my machines also running
with a fully patched Office XP Pro and Windows XP Pro
does return results. There does appear to be a problem
with this feature somewhere as the problem crops up at
various client sites as well as one of our machines.
In Word, create the following macro and put some .doc
files in the c:\temp folder
<<<<<
Sub TestSearch()
Dim NumDestFiles As Integer
Dim fs As FileSearch
Dim SearchDir As String
SearchDir = "C:\TEMP"
Set fs = Application.FileSearch
NumDestFiles = 0
If (Dir(SearchDir, vbDirectory) <> "") Then
With fs
.NewSearch
.LookIn = SearchDir
.SearchSubFolders = False
.FileName = "*.doc"
.FileType = msoFileTypeAllFiles
RetVal = .Execute
NumDestFiles = .FoundFiles.Count
End With
End If
End Sub
brand new Dell laptop, running Windows XP Pro (with all
patches applies as of 10/17), and Office XP Pro (with all
patches applied as of 10/17).
There are about 50 Word documents with .doc file
extensions in the "c:\temp" folder.
The following code sample finds the folder, but
regardless of how I try and tweak the FileSearch
settings, it always returns 0 files found. Searching
the folder via the command prompt/desktop shows they
exist. Are there any known problems with the FileSearch
not returning results? This happens on a number of our
clients computers and works on some of ours, however now
with this new laptop all patched up, it is a reproducable
problem.
Note, this doesn't appear to be a coding problem as the
same code snippet on another of my machines also running
with a fully patched Office XP Pro and Windows XP Pro
does return results. There does appear to be a problem
with this feature somewhere as the problem crops up at
various client sites as well as one of our machines.
In Word, create the following macro and put some .doc
files in the c:\temp folder
<<<<<
Sub TestSearch()
Dim NumDestFiles As Integer
Dim fs As FileSearch
Dim SearchDir As String
SearchDir = "C:\TEMP"
Set fs = Application.FileSearch
NumDestFiles = 0
If (Dir(SearchDir, vbDirectory) <> "") Then
With fs
.NewSearch
.LookIn = SearchDir
.SearchSubFolders = False
.FileName = "*.doc"
.FileType = msoFileTypeAllFiles
RetVal = .Execute
NumDestFiles = .FoundFiles.Count
End With
End If
End Sub