Flagging Sentences Starting with Undesirable Words

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


Jasmin needs a way to somehow flag sentences that begin with a set of undesirable words, such as conjunctions.

The easiest way to accomplish this task is to use a macro. Conceptually, the macro needs to step through each sentence in a document, look at the first word in the sentence, and flag the word if it is undesired. The following macro will do just that:

Sub HighlightBadFirstWords()
    Const BadWordList = " And Or But Hopefully "
    Dim s As Range

    For Each s In ActiveDocument.Content.Sentences
        If InStr(1, BadWordList, " " & _
          Trim(s.Words.First.Text & " "), vbTextCompare) Then
            s.Words.First.HighlightColorIndex = wdYellow
        End If
    Next s
End Sub

The key to this macro is putting together the undesirable words in the BadWordList constant. Notice that each word is separated by a space and there is a space at the beginning and end of the words. This spacing is important. It is also important to make sure that none of the words includes any punctuation marks.

The reason for this is rather simple. The macro uses the Words collection for each sentence in the document. This collection treats punctuation as a word. Thus, if a sentence began with "But," (with the comma), then that is two words—"But" and ",".

You should also understand that the macro is case insensitive. So, if a sentence begins with "AND," that will be marked, even though the BadWordList constant contains "And". If you want to make the macro pay attention to case, then change vbTextCompare to vbBinaryCompare.

All of that said, Jasmin may want to remember that there is no grammatical rule that indicates it is improper for a sentence to start with a conjunction. Check your favorite style guide, and you will find that this is the case. (Mine tends to be the Chicago Manual of Style. In the 17th edition, see 5.203; in the 18th edition see 5.209.) Even with no disallowing rule in place, however, you may find it helpful to mark such words to make sure that their sentence-beginning use is warranted.

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 (13973) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, 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

Saving All Open Workbooks

Wouldn't it be nice to have a single command that would save each of you open workbooks, all at once? It's easy to do ...

Discover More

Flush Left and Flush Right On the Same Line

Need to have some text at the left margin and some at the right, all on the same line? It's easy to do if you use your ...

Discover More

Finding Where the Current Document is Saved

It is possible to have multiple documents on your system, each with the same filename. If you work on those documents at ...

Discover More

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!

More WordTips (ribbon)

Understanding Smart Cut and Paste

Editing is generally made easier by a feature that Word calls smart cut and paste. If you prefer, you can turn the ...

Discover More

Symbols for Non-Printing Characters

Displaying non-printing characters can help you better understand the formatting and contents of your documents. What do ...

Discover More

Adding an Optional Break

The no-width optional break is primarily used for Asian languages in Word. It can have value for English-speakers, as ...

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 seven less than 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.