FileSearch Problem

B

Bin

I am using a macro with FileSearch in both office and
home computers. It works perfect in my office, but not
work at home. The problem is in FileSearch. The code is
as follow:

With Application.FileSearch
.NewSearch
.LookIn = FilePath
.FileName = SumBookName
.FileType = msoFileTypeExcelWorkbooks
.MatchTextExactly = True
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) = FilePath +
SumBookName Then
FileExist = True
Exit For
End If
Next i
Else
FileExist = False
End If
End With

By using debug.print, I found Execue() is 0.
I am using same Excel 2002 at my office and home but at
differnt OS. Office is Windows2K, home is WinXP. What is
the problem? Anybody can help me?
 
D

Don Guillett

try commenting out
.FileType = msoFileTypeExcelWorkbooks
and/or put " " around sumbookname
.FileName = SumBookName
 
B

Bin

I am sorry. It doesn't work.
SumBookName is an variable, can not pu "" around it.
I deleted FileType code, but it still doesn't work.
What can I do else?
Thanks.

Bin
 
B

Bin

Sorry. I can not use a real file name. It is input by
user. Since I am using the same Excel 2002, same CD, for
both computers with different OS, is it OS problem?
 
D

Dave Peterson

There have been lots of posts that say that .filesearch is flakey in xl2002.
And some posts that say it's even worse under winXP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top