Filesearch also returns 'Copy of'' files too

F

FUBARinSFO

Hi:

There are two files in the folder c:\temp:
C:\temp\foobar.doc
C:\temp\Copy of foobar.doc

When I use .Filesearch as below, it returns both files, not the one
'foobar.doc'.

The workaround seems to be to revert back to DIR$() to get the file
names that start with the string, not the files that contain the
string as is the case with Filesearch. Is this still the answer for
Word 2003?

Thanks in advance for your help.

-- Roy Zider


sSrcPath = c:\temp
Set oFS = Application.FileSearch ' FileSearch object
With oFS
.LookIn = sSrcPath
.FileName = "\foo*.doc"
If .Execute >0 Then
< ... do something>
End if
End with
 

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