Checking for a List of Phrases in a Document

Written by Allen Wyatt (last updated April 7, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


4

Martin recently received, from his company's legal team, a list of phrases that they don't like to see in documents the company creates. For instance, in most cases the phrase "solution will" should be, instead, "solution is intended to." Martin wonders if there is a way to have this new list of phrases checked and flagged automatically in Word, perhaps through the grammar checker.

The grammar checker won't do it, unfortunately. There simply is no way, in Word, to add your own phrases so that the grammar checker can, well, "check" them.

It sounds, though, like you may need two solutions—one that will kick into play as you are composing new documents and another that can be used to check existing documents. The "as you compose" solution is actually quite easy—all you need to do is to use AutoCorrect to automatically change the offending phrases for you.

  1. Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 or a later version, display the File tab of the ribbon and then click Options.)
  2. Click Proofing at the left side of the dialog box.
  3. Click AutoCorrect Options. Word displays the AutoCorrect dialog box. (See Figure 1.)
  4. Figure 1. The AutoCorrect dialog box.

  5. In the Replace box, enter your offending phrase.
  6. In the With box type the preferred phrase.
  7. Click the Add button.
  8. Repeat steps 4 through 6 for each of the remaining offending phrases.
  9. Click Close to close the dialog box.

Now, as you type in your document, whenever an offending phrase is entered and the space or punctuation mark after that phrase is pressed, Word should automatically replace the phrase with the preferred phrase.

Of course, the AutoCorrect approach won't help with existing documents, nor will it help if blocks of text are copied from other documents and pasted into the current document. In those cases, you need a different approach. The simplest is to use the Find and Replace capabilities of Word to look for an offending phrase and make the determination if you want to replace it with the preferred phrase or not. This can work great if you have only a few phrases you need to correct.

If your list of phrases is considerably longer, you may want to consider using a macro to mark infractions. Here's a simple approach.

Sub ReplacePhrases()
    Dim sBadPhrase(19) As String
    Dim sGoodPhrase(19) As String
    Dim iCount As Integer
    Dim J As Integer

    iCount = 6   ' Set to number of phrases

    sBadPhrase(1) = "first offensive phrase"
    sBadPhrase(2) = "second offensive phrase"
    sBadPhrase(3) = "third offensive phrase"
    sBadPhrase(4) = "fourth offensive phrase"
    sBadPhrase(5) = "fifth offensive phrase"
    sBadPhrase(6) = "sixth offensive phrase"

    sGoodPhrase(1) = "first preferred phrase"
    sGoodPhrase(2) = "second preferred phrase"
    sGoodPhrase(3) = "third preferred phrase"
    sGoodPhrase(4) = "fourth preferred phrase"
    sGoodPhrase(5) = "fifth preferred phrase"
    sGoodPhrase(6) = "sixth preferred phrase"

    For J = 1 to iCount
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = sBadPhrase(J)
            .Replacement.Text = sGoodPhrase(J)
            .Forward = True
            .Format = False
            .MatchWholeWord = False
            .MatchCase = False
            .MatchWildcards = False
            .Wrap = wdFindContinue
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Next J
End Sub

This macro does a mass replacement of the values stored in the sBadPhrase array with the phrases stored in the sGoodPhrase array. All you need to do is to set up the arrays with your phrases and change iCount so that it is equal to the number of phrases you have defined. (If you go above 19 phrases, you'll also need to change the declaration of the two arrays so that they are large enough.)

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (5140) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Continuing Macro Lines

Program a macro, and you can easily find that some lines get very long. If you want to shorten the lines so they are more ...

Discover More

Problem with Menus Crashing Word

What do you do if, one day, one of your Word menus suddenly stops working and actually crashes the program? Here's the ...

Discover More

Returning Nothing If Two Values are Empty

Excel includes a large number of functions that can be used in evaluating the data in a worksheet. In this tip you learn ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Selecting a Text Block

Word has an interesting way of allowing you to select a rectangular block of text, without reference to what may be ...

Discover More

Capitals After Colons

Do you want Word to always capitalize the first letter appearing after a colon? The program won't do it by default, but ...

Discover More

Selective Undo

Ever wonder why you can't undo just a single edit you made a few minutes earlier? The short answer is that it could make ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 + 5?

2018-01-16 15:56:40

Paul Hanson

Hint from my experience, after adding a 7th phrase and having it not work ... until I changed the the iCount value to 7.


2018-01-16 10:45:29

Andrew

As a matter of style, I like to format the code-created tables (and similar repetitive code) this way, which makes it easier, at a glance, to make sure everything is consistent:

sBadPhrase(1) = "first offensive phrase" : sGoodPhrase(1) = "first preferred phrase"
sBadPhrase(2) = "second offensive phrase" : sGoodPhrase(2) = "second preferred phrase"
sBadPhrase(3) = "third offensive phrase" : sGoodPhrase(3) = "third preferred phrase"
sBadPhrase(4) = "fourth offensive phrase" : sGoodPhrase(4) = "fourth preferred phrase"
sBadPhrase(5) = "fifth offensive phrase" : sGoodPhrase(5) = "fifth preferred phrase"
sBadPhrase(6) = "sixth offensive phrase" : sGoodPhrase(6) = "sixth preferred phrase"


2018-01-13 12:26:32

Allen

Neal,

Thanks for your comments. All of the explanations on this site are written specific to the Windows versions of Word. With you using a Mac version, there will be differences -- such as the one you note. (On the Mac you click the Word menu and then click Preferences to get to the same settings that are in the Word Options dialog box in the Windows version.)

This isn't the only difference, of course; there are many others. Even with the differences, I hope that you'll find the instructions helpful and understand that Mac users often need to do an "on the fly translation" from how things work under Windows.

-Allen


2018-01-13 12:04:04

Neal Perkins

I don't understand...

In the above tip comment it says:
"Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 and later versions display the File tab of the ribbon and then click Options.)"

I looked all over...it's not there. In Word for Mac current subscription version, this option appears in:
Tools: AutoCorrect

If the above info is correct as I think, how many times does this sort of thing happen? I have wasted time a couple of times now on this sort of issue. I say all this still very appreciative of your service!
Thanks


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.