2 Quick Ways to Find Multiple Items in One Word Document at the Same Time

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

  1. 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.A list of words to be found
  2. Secondly, click “Developer” tab.
  3. Then click the “Visual Basic” to open the VBA editor. The alternative way is to press “Alt+ F11”.Click "Developer"->Click "Visual Basic"
  4. Next click “Normal” then the “Insert” tab.
  5. And choose “Module” on the menu.Click "Normal"->Click "Insert"->Click "Module"
  6. 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
  1. Lastly, click “Run”.Paste codes->Click "Run"
  2. Now there is a box. Enter the path and name of the list document you just saved. Then click “OK”.Input the path of the list document

The next thing you see is all found words are in highlighting.Highlight found words

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

Leave a Reply

Your email address will not be published.