Thread: FileSearch
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default FileSearch

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