Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Highlight Words from a Word List.
Written by Allen Wyatt (last updated March 7, 2026)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Paul has a document that he needs to check against a word list contained in another document. If the document being checked contains one of the words in the list, then the word in the document (not in the word list) needs to be highlighted. The word list is large, on the order of 20,000 words, and Paul is wondering what the best way to do this is.
The easiest way to do this is to write your own macro that will do the comparisons for you. Start by putting the words you want find in their own document. Put one word (or phrase) per paragraph (just press Enter after each word or phrase), and make sure the document is named "checklist.docx." With the document in the C: drive, the following macro can be used:
Sub CompareWordList()
Dim sCheckDoc As String
Dim docRef As Document
Dim docCurrent As Document
Dim p As Paragraph
Dim sLookWord As String
sCheckDoc = "c:\checklist.docx"
If Dir(sCheckDoc) = "" Then
MsgBox "Checklist file not found."
Exit Sub
End If
Set docCurrent = ActiveDocument
Set docRef = Documents.Open(sCheckDoc)
Options.DefaultHighlightColorIndex = wdYellow
With docCurrent.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = True
.MatchWholeWord = True
.MatchCase = True
.MatchWildcards = False
.Wrap = wdFindContinue
.Replacement.Highlight = True
.Replacement.Text = "^&"
For Each p In docRef.Paragraphs
sLookWord = Trim(Replace(p.Range.Text, vbCr, ""))
If Len(sLookWord) > 0 Then
.Text = sLookWord
.Execute Replace:=wdReplaceAll
End If
Next p
End With
docRef.Close False
End Sub
All you need to do is have the document open that you want checked, and then run the macro. If the document containing the words to check is named differently or in a different location, just change the line that sets sCheckDoc so that it has a different full path name for the document.
Basically, the macro grabs each word or phrase from checklist.docx and then does a Find and Replace operation using that word in the document. If the word is found, then it is highlighted in yellow. The macro also pays attention to case in what it finds. Thus, if your search word is "luckily," then it will only highlight the word if it is lowercase, meaning if a sentence begins with "Luckily," then it would not be highlighted.
You can put as many words in the checklist.docx document as you want, but understand that a Find and Replace is done for each of them. That means that if it contains a lot of words and the document you are searching is large, the macro can take quite a while to run. Paul said that he had 20,000 words that needed to be checked for, which means that the macro would do 20,000 Find and Replace operations. That may be enough time to take a lunch break while the macro is running.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1173) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Highlight Words from a Word List.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2021 or Microsoft 365. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word Step by Step today!
If you need to move the insertion point within your macro, then you'll want to note the HomeKey method, described in this ...
Discover MoreWhen working with documents in a macro, it makes sense that you may need to create a document from time to time. Here's ...
Discover MoreWhen writing a macro to process the text in a document, you may need to move the insertion point to the end of a line. ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2026 Sharon Parq Associates, Inc.
Comments