Hi wolfgangea,
Make a copy of the xls file, move the list of words to the first column on
the first worksheet and save this copy as 'Text (Tab delimited) (*.txt)'.
In Word, record any macro, say record clicking the B-button on the Standard
toolbar, and be sure to choose the document under 'Store macro in'.
Choose Tools | Macro > Macro's..., select your macro and choose Edit. The
VBA-editor opens.
Replace the entire macro by the following:
Sub HighlightWords()
Dim strWord As String
Selection.HomeKey Unit:=wdStory
Open "G:\temp\ListOfWords.txt" For Input As #1
While Not EOF(1)
Line Input #1, strWord
With Selection.Find
.ClearFormatting
.Text = strWord
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.Execute
End With
While Selection.Find.Found
Selection.Range.HighlightColorIndex = wdRed
Selection.Find.Execute
Wend
Selection.HomeKey Unit:=wdStory
Wend
Close #1
End Sub
Replace "G:\temp\ListOfWords.txt" by the .txt file you just made.
Click the Save button in the VBA editor to save the document. Close the VBA
editor. In Word, choose Tools | Macro > Macros... Select HighlightWords and
click Run.
Good luck,
Cooz
--
PS: If this is a satisfying answer to your question and you're logged in via
the Microsoft site, please click Yes to "Did this post answer the question?".
Thanks.
> I have a list of different words in an excel speadsheet that I want to search
> in a word document and if it finds that word to highlight it in red
> throughout the whole document. If possible I would load these words into an
> array and go through a loop to find the occurences. I do not have to use
> excel, the list can be imported into word.