FileSearch to find partial words?

E

Ed

I have the following code in a workbook that does a text search through a
folder of Word documents:

With Application.FileSearch
.NewSearch
.LookIn = strLocation
.SearchSubFolders = False
.TextOrProperty = strSearchFor
.MatchAllWordForms = True
.Filename = strName & "*.doc"
.Execute

The code works fine - except it won't find part of a word. For instance, I
can't use "brak" (as strSearchFor) to find "brake", "brakes", and "braking".
I had hoped the MatchAllWordForms setting would do it, but no such luck.

Note: Mswds_en.lex is installed, but I have no idea if it's registered (as
per MatchAllWordForms Help topic.) How would I check and rectify in need
be?

Ed
 
H

Helmut Weber

Hi Ed,

according to the help .TextOrProperty
allows the use of the wildcards ? and *.

Though I doubt, whether this will help you much.

I'd use an invisible Word-instance
together with Word's wildcard search.

Not perfect, still. :-(


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
E

Ed

Hi, Helmut.

Actually, this can be used to solve my issue. The search terms (up to
three) are typed into cells. If I put a drop-down or option button next to
each term, I can allow the user to indicate if this is a complete word
(default), or the beginning, end, or center bit of a word. It might need a
bit more tweaking than that, but it should work out okay.

Thank you!
Ed
 

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