Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesearch : .zip files not found ??? Benoît HUBERT Excel Programming 1 September 1st 04 06:28 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 4 September 1st 03 08:50 PM
FileSearch doesn't find zip files Hub van de Laar Excel Programming 3 September 1st 03 07:43 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 0 September 1st 03 06:53 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 0 September 1st 03 06:52 PM


All times are GMT +1. The time now is 06:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"