Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
filesearch not finding files
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
filesearch not finding files
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. "Kevin" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filesearch : .zip files not found ??? | Excel Programming | |||
FileSearch dislikes Zip-files | Excel Programming | |||
FileSearch doesn't find zip files | Excel Programming | |||
FileSearch dislikes Zip-files | Excel Programming | |||
FileSearch dislikes Zip-files | Excel Programming |