FileSearch only returns Word docs

M

muyBN

When I use Application.FileSearch, it only returns Word documents:

With Application.FileSearch
.FileName = strNewFile '6386_P05*.*
.LookIn = strGradingDocPath 'C:\6386
.SearchSubFolders = True
.Execute

Any ideas on how to pick up all file types? Running Office 2003.
 
P

Perry

have you tried to include filetype in filesearch like in

With Application.FileSearch
.FileType = 1 '< all files
.FileName = strNewFile '6386_P05*.*
.LookIn = strGradingDocPath 'C:\6386
.SearchSubFolders = True
.Execute
End With

Krgrds,
Perry
 
M

muyBN

After hours of painful experimentation (wasted my whole Saturday on it), I
finally learned that Application.FileSearch's .FileType "kind of" takes care
of my question, for anyone else needing to know. If you write .FileType as
one of your Application.FileSearch criteria then type a space and equal sign,
it intellisenses a bunch of options.

Above I said "kind of" because MS claims that the msoFileTypeOfficeFiles
option will return .htm and .html files, but it doesn't--maybe it will if
it's an HTML page created in Word, I don't know, but I found that it didn't
pick up a regular old HTML page created in Notepad. So, in my macro, I just
set up a variable that parses the file extension; and if it's one of the
standard Office extensions, set the variable equal to msoFileTypeOfficeFiles
and msoFileTypeAllFiles for all others (got an error when I tried to used
quotation marks).

Now I have another question about returning the folder for the file found,
but I'll do that in a different post. Since the excited answer for this one
ran a little long, the question might get buried and never answered.
 

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