Flagging Sentences Starting with Undesirable Words

Written by Allen Wyatt (last updated April 11, 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

Running Macros in the Background

Want to run a macro in Excel, but not sure if doing so will tie up your computer? Here's how macro processing really happens.

Discover More

Combining First and Second Numbered Levels on One Paragraph

Want to customize your paragraph numbering in Word? There are a few tricks that can be used to automatically display the ...

Discover More

Stopping a Workbook from Persistently Auto-Loading

Excel has the capability to automatically open workbooks when you first start the program. You may not want to have one ...

Discover More

Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!

More WordTips (ribbon)

Preventing the Insertion of Non-Breaking Spaces

When you copy and paste information from the Internet, you may end up with a lot of non-breaking spaces in the pasted ...

Discover More

Better Ways to Insert Symbols

The traditional way to insert symbols into a document is to use the Symbol dialog box. This tip looks at ways other than ...

Discover More

Automatic Non-breaking Spaces in Dates

It drives some people crazy to have a date break across two lines. If you find yourself in this mindset, then you'll ...

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 one more 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.