Reply
 
Thread Tools Display Modes
  #1   Report Post  
Krazykaj
 
Posts: n/a
Default Search for specific words in a document using an external list?

Hello,

I have a word document (for example, Ill call it Article.doc) which is
rather large, containing certain news articles.

I wish to do a search/find and identify specific key words in Article.doc.
However, the list of possible words in Article.doc that I wish to find (if
they are there), number about 500.

I have this list of words that I want to be found stored in a separate
document that is always being updated/changed. (For example, Ill call this
document List.doc)

I do not want to have to go and use the Find Feature built-in to MS Word and
copy/paste all 500 words individually and search Article.doc to see if they
are present.

So I was curious, is there a way I can get MS Word to take/store the list of
words in List.doc and then go through Article.doc and find any instances
of any of the words from the List.doc.
If possible I would like to also go one step further, and not only find
instances of any of the 500 words in the Article.doc, but to also highlight
them in yellow.

If you have any help or suggestions, I would greatly appreciate it :-D

Thankyou kindly for you time,

Kind Regards
KJ
  #2   Report Post  
Klaus Linke
 
Posts: n/a
Default

Hi KJ,

I think this problem has come up a few times. You might be able to find
macros if you google the Word newsgroups and posts from Doug Robbins, IIRC,
though I didn't find anything in a quick search.
It shouldn't be too hard to write something from scratch, either.

You can use a sub to hightlight some specific word:

Sub HighlightWord(strWord As String)
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = strWord
.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

The rest of the problem would be to read the text from List.doc into a
Variant, split it into words (say using Split, and vbCr as the delimiter),
and run HighlightWord(myArray(i)) for each of the words in the array.

Regards,
Klaus





"Krazykaj" wrote:
Hello,

I have a word document (for example, I'll call it 'Article.doc') which is
rather large, containing certain news articles.

I wish to do a search/find and identify specific key words in 'Article.doc'.
However, the list of possible words in 'Article.doc' that I wish to find
(if
they are there), number about 500.

I have this list of words that I want to be found stored in a separate
document that is always being updated/changed. (For example, I'll call
this
document 'List.doc')

I do not want to have to go and use the Find Feature built-in to MS Word
and
copy/paste all 500 words individually and search 'Article.doc' to see if
they
are present.

So I was curious, is there a way I can get MS Word to take/store the list
of
words in 'List.doc' and then go through 'Article.doc' and find any
instances
of any of the words from the 'List.doc'.
If possible I would like to also go one step further, and not only find
instances of any of the 500 words in the 'Article.doc', but to also
highlight
them in yellow.

If you have any help or suggestions, I would greatly appreciate it :-D

Thankyou kindly for you time,

Kind Regards
KJ



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
After saving document why are words changed into symbols Kimberly Goolie Microsoft Word Help 0 January 21st 05 07:53 PM
After saving document why are words changed into symbols Kimberly Googlie Microsoft Word Help 0 January 21st 05 07:51 PM
How do I index all words in an msword document? Adam Rabinowitz Microsoft Word Help 0 January 11th 05 03:21 PM
Why are the words in my document not there? Sue-LeadDog Microsoft Word Help 3 December 16th 04 06:51 AM
Word Count mel Microsoft Word Help 2 December 14th 04 10:17 PM


All times are GMT +1. The time now is 08:02 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"