Thread: FileSearch
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default FileSearch

Does changing this:
..Filename = "*.xls"
to
..Filename = ".xls"

help.

By the way, there have been a few posts that say that .filesearch is flakey in
xl2002. It sometimes doesn't find all the files. Although, I've never seen it
miss all of them.

wrote:

This works for me in Excel 97, but not in 2002 (SP2).
Any other ideas?

-----Original Message-----
Stephen

Perhaps your search criterion(a) is/are not correct.

This works for me.

Sub file_find()
Set fs = Application.FileSearch
With fs
.lookin = "e:\program files\microsoft

office\exceldata"
.Filename = "*.xls"
'or "*searchstring*"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
Else
MsgBox "There were no files found."
End If
End With
End Sub

Gord Dibben Excel MVP

On Fri, 11 Jun 2004 17:29:37 -0700, "Stephen"
wrote:

I can't get FileSearch to return a correct file

search.
Application.FileSearch.FoundFiles.Count is always zero.

Does the Application.FileSearch no longer work in Excel
VB 2002?


Tx,

Stephen


.


--

Dave Peterson