Document Editing Problems

Create an Automatic Keyword Checklist in Microsoft Word

Nimra MalikNimra Malik Nov 18, 2026 869 views

Question details

The user wants to compare an assignment against a source keyword list, highlight matches, and identify missing terms.

Create an Automatic Keyword Checklist in Microsoft Word
Product
Microsoft Word
Device & OS
not provided
Scenario
Check an assignment against a separate list of required keywords.
Observed behavior
The desired result is a document with matching keywords highlighted and a report of terms that are absent.
Before you start

Put each keyword on a separate line in a plain-text file and open the assignment in desktop Word. For the macro, save the keyword file in a text encoding supported by your system and make sure you can access Word's VBA editor.

Solution 1Recommended

Use a Word VBA macro to highlight keywords and report missing terms

Use this approach for repeated checks against a plain-text keyword list.

Word does not have a built-in automatic cross-document checklist for this workflow. This macro searches the assignment's main text, highlights matches in yellow, and displays missing terms.

The search is case-insensitive and matches parts of words. It checks nonoverlapping occurrences in the main document body, not text in headers, footers, or text boxes. Existing highlights are not removed.

1
Open the VBA editor

Open the assignment in desktop Word, then press Alt+F11 or choose Developer > Visual Basic. If the Developer tab is hidden, enable it in Word's ribbon settings.

2
Insert the macro

In the VBA editor, select the assignment's project, choose Insert > Module, and paste this code: Sub CheckKeywordList() Dim doc As Document Dim searchRange As Range Dim picker As Object Dim filePath As String, keyword As String, missing As String Dim fileNumber As Integer, found As Boolean Set doc = ActiveDocument Set picker = Application.FileDialog(3) With picker .Title = "Select the keyword text file" .Filters.Clear .Filters.Add "Text files", "*.txt" .AllowMultiSelect = False If .Show <> -1 Then Exit Sub filePath = .SelectedItems(1) End With fileNumber = FreeFile Open filePath For Input As #fileNumber Do Until EOF(fileNumber) Line Input #fileNumber, keyword keyword = Trim$(keyword) If Len(keyword) > 0 Then If Len(Replace(keyword, "^", "^^")) > 255 Then missing = missing & vbCrLf & keyword & " (too long to search)" Else found = False Set searchRange = doc.Content With searchRange.Find .ClearFormatting .Text = Replace(keyword, "^", "^^") .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Do While searchRange.Find.Execute found = True searchRange.HighlightColorIndex = wdYellow searchRange.Collapse wdCollapseEnd Loop If Not found Then missing = missing & vbCrLf & keyword End If End If Loop Close #fileNumber If missing = "" Then MsgBox "All listed keywords were found, or the list was empty." Else MsgBox "Missing or not searched:" & missing End If End Sub

3
Run the check

Return to the assignment, choose Developer > Macros, select CheckKeywordList, and click Run. In the file picker, select the keyword .txt file.

4
Review and save

Read the missing-term message and review the yellow highlights in the document. Use File > Save As and choose a macro-enabled Word document (.docm) if you want to keep the macro in the assignment.

Use a Word VBA macro to highlight keywords and report missing terms
Macro security: Run macros only when you understand and trust their code. An empty keyword file produces no matches, so check the source list if the result says it may be empty.
Free Microsoft Office alternative

Review Word documents with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for opening and reviewing Word documents. Use WPS Writer to find and highlight keywords manually; it does not fix Word's automatic checklist limitation.

Search and highlight keywords while reviewing an assignmentCompatible with Microsoft Word DOC and DOCX filesFamiliar editing tools make moving from Word straightforwardFree and lightweight for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Can Word automatically compare an assignment with a keyword list?

Word has no built-in automatic cross-document checklist for this exact workflow. In desktop Word, a VBA macro can read a keyword list, search the assignment, and report missing terms.

How should I prepare the keyword file for the macro?

Save the list as a plain-text .txt file with one keyword or phrase per line. When you run CheckKeywordList from Developer > Macros, select that file in the picker.

Will the macro match keywords inside longer words?

Yes. The example sets MatchWholeWord to False, so a keyword can match part of a longer word. Change it to True in the VBA editor if you need whole-word matches.

Does the macro search headers and text boxes?

No. The example searches the main document body through doc.Content. Headers, footers, and text boxes require additional VBA code.

How can I check keywords without a macro?

Choose Home > Find in Word and search for each term. Highlight matching text with Home > Text Highlight Color and record any terms with no results separately.