Find function question-help!

G

Guest

Hi-
I want to use Control-F (Find function) and see all of the results that the
program finds in context of their sentences. In other words, like Adobe
Acrobat-when you run a Find on a PDF file, it brings up the context of the
keyword under the results (i.e. it shows you the part of the sentence that
the key word is within for each result). Is there a way to do this in MS
Word 2003 or is there a macro that I could use to program this into Word?
All help is very much appreciated! Thanks!!!
 
S

Suzanne S. Barnhill

There's nothing comparable to this, but you can "Highlight all items found"
so that you can scroll through the document and look at all the found terms,
or you can step through one at a time using Find Next.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jay Freedman

nycguy96 said:
Hi-
I want to use Control-F (Find function) and see all of the results
that the program finds in context of their sentences. In other
words, like Adobe Acrobat-when you run a Find on a PDF file, it
brings up the context of the keyword under the results (i.e. it shows
you the part of the sentence that the key word is within for each
result). Is there a way to do this in MS Word 2003 or is there a
macro that I could use to program this into Word? All help is very
much appreciated! Thanks!!!

There wasn't before, but your question inspired me to write a userform to
mimic the Adobe function. Watch this thread later this evening -- I'll post
the URL for a template you can download.
 
G

Guest

Wow Jay-Thanks very much for the help! I look forward to your results and
really appreciate it!
 
J

Jay Freedman

OK, I got it posted. Download http://jay-freedman.info/finder.zip and
unzip it into your Word startup folder (to find the right folder, look
in Word's Tools > Options > File Locations dialog for the one named as
Startup). Then restart Word, open a document, and press Ctrl+Alt+F
(the template swipes that shortcut from the InsertFootnoteNow command,
which I figured was no big loss) to start the userform.

The controls across the top of the userform do the same as the ones in
Adobe Reader's search pane. You can use the same codes in the Find
What box (such as ^p for paragraph marks and ^t for tabs) that you use
in Word's regular Find dialog. The Enter key is the same as clicking
the Search button, and the Esc key is the same as clicking the Quit
button.

The results of the search show up to three words on either side of the
requested word or phrase for each occurrence. Single-click an entry to
see its page number below the list. Double-click an entry to go to
that occurrence in the document (it may be behind the userform).

Let me know if you think of any improvements, and I'll see if I can
make them.
 
G

Guest

THANK YOU Jay! That is amazing-It totally works great. I hate to be
nitpicky-but if the word that I search for is very near the beginning of the
sentence (like the 2nd word in the sentence) then the search result simply
shows "..." Is there any way to fix this? Also, is there any way to increase
the amount of words that it shows to make it greater then three words (like 6
words instead)? Again, thank you very much-I really appreciate it!
 
J

Jay Freedman

Try it again -- same URL.

The code now does try to select 6 words before and after the search
term. Understand, though, that when Word counts "words" it includes
punctuation and paragraph marks, so what you see may be less.
 
S

Suzanne S. Barnhill

You must not use footnotes very often. <g>

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Guest

Thanks-it looks great Jay! For some reason, it is still pulling "..." or
similar when the word is close to the beginning of the sentence-is there any
way to tell the code not to look at blanks and only pick out words? If this
is not possible then no big deal-it looks awesome the way it is!
thanks again!
 
J

Jay Freedman

OK, I understand now. The "..." doesn't have anything to do with how
close the word is to the beginning of the sentence. The code was
putting it at the start and end of every entry. I've taken it out now.
Have fun!
 
J

Jay Freedman

No, I don't.* But that's the beauty of Word -- if you don't like my
choice, change it!

--
Regards,
Jay Freedman
Microsoft Word MVP

*I'm not Terry Pratchett. If I were, I might find more entertaining
uses for footnotes. :)
 
G

Guest

Awesome-thanks again!

Jay Freedman said:
OK, I understand now. The "..." doesn't have anything to do with how
close the word is to the beginning of the sentence. The code was
putting it at the start and end of every entry. I've taken it out now.
Have fun!
 

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