In this post, our focus is on exhibiting 2 quick ways to find multiple items in one Word document at the same time.
Anyone who is familiar with Word must know the “Find and Replace” option quite well. It works well when the finding text is a consecutive string. But, unfortunately, it gets complicated when we want to search for multiple separate words at the same time. And out there, the demand is strong for striking out a list of words or phrases in one document at one move. For example, if you are an editor, there may be a couple of words which should never appear in any document. If so, you will need workarounds to mark the occurrence of some specific words.
Here are 2 solutions available:
Method 1: Import Words to the Exclude Dictionary
Add a bunch of words or phrases to the exclude dictionary in Word, and then there shall be a red wave line appearing under the matched words to flag them out.
Detailed steps to add words to the exclude dictionary are in this article: 4 Useful Tips for Word Spelling and Grammar Checker
Method 2: Use Word Macro
- First and foremost, put all words you want to search in one document. Each words or phrase should occupy one paragraph. Here let’s call it “list document”. Save the document.
- Secondly, click “Developer” tab.
- Then click the “Visual Basic” to open the VBA editor. The alternative way is to press “Alt+ F11”.
- Next click “Normal” then the “Insert” tab.
- And choose “Module” on the menu.
- Double click on new module to bring out the editing area and paste the following macro there:
Sub FindMultiItemsInDoc() Dim objListDoc As Document Dim objTargetDoc As Document Dim objParaRange As Range, objFoundRange As Range Dim objParagraph As Paragraph Dim strFileName As String strFileName = InputBox("Enter the full name of the list document here:") Set objTargetDoc = ActiveDocument Set objListDoc = Documents.Open(strFileName) objTargetDoc.Activate For Each objParagraph In objListDoc.Paragraphs Set objParaRange = objParagraph.Range objParaRange.End = objParaRange.End - 1 With Selection .HomeKey Unit:=wdStory ' Find target items. With Selection.Find .ClearFormatting .Text = objParaRange .MatchWholeWord = True .MatchCase = False .Execute End With ' Highlight the found items. Do While .Find.Found Set objFoundRange = Selection.Range objFoundRange.HighlightColorIndex = wdBrightGreen .Collapse wdCollapseEnd .Find.Execute Loop End With Next objParagraph End Sub
- Lastly, click “Run”.
- Now there is a box. Enter the path and name of the list document you just saved. Then click “OK”.
The next thing you see is all found words are in highlighting.
Secure Your Word Documents
One of the most popular measures to prevent your Word documents from corrupted is to take backups. They can provide you with a peace of minds when you have a damaged docx. So take your time to back up your important files right now.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt xlsx and pdf repair software products. For more information visit www.datanumen.com