Finding RTF docs based on user criteria

C

Clint

I was wondering if there is a way to search through a
file of RTF docs based on user criteria (from an Access
form). There are hundreds of these RTF docs currently
saved, but they are all in one folder. As an example, if
the user picks "rr00f" as filter criteria, I would then
look through every doc in the folder to find the ones
that have that exact text anywhere in the body of the doc
and then return each file name. Of course, the users
will be picking many different values to filter by, so
the actual number of docs that have their combination of
values would be small.

What do you think? Is this viable? I am clueless about
the code to use to do this, but I imagine it could be
very simple.

Thanks again,
Clint
 
D

Doug Robbins - Word MVP

Hi Clint,

This is certainly possible.

Using the Dir function, it is possible to open each document in turn from a
folder. Then using

Selection.Find.ClearFormatting
With Selection.Find
If .Execute(FindText:="rr00f", Wrap:=wdFindContinue, Forward:=True)
= True Then
MsgBox ActiveDocument.Name
End If
End With

You could display a message box with the filename of write the filenames to
another file, or what ever is your fancy.

The whole process could be wrapped up into a procedure that ran from an
Access form so that what was being found would be a something displayed on
the form.

If you need help in developing this, send me an email.

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP
 

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