Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Finding Long Sentences.
Written by Allen Wyatt (last updated July 12, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Bruce is looking for some way to have Word automatically mark long sentences in a document. For instance, he may want to have those sentences with more than 20 words marked in some color so that they are easily located.
Fortunately, Word maintains a Sentences collection, accessible through VBA, that consists of each sentence in a document. You can examine each item in this collection (each individual sentence) to determine if it is longer than your desired length. The following macro provides an example of how this is done.
Sub MarkLong1()
Dim iMyCount As Integer
Dim iWords As Integer
If Not ActiveDocument.Saved Then
ActiveDocument.Save
End If
iWords = 20 ' target word count
iMyCount = 0
For Each MySent In ActiveDocument.Sentences
If MySent.Words.Count > iWords Then
MySent.Font.Color = wdColorRed
iMyCount = iMyCount + 1
End If
Next
MsgBox iMyCount & " sentences longer than " & _
iWords & " words."
End Sub
Notice that the macro starts by saving the document. This is done because long sentences are going to be formatted as red text, and saving makes sure you have a "pre-change" version saved. Each sentence is examined, and if it is longer than the desired length (defined by the variable iWords) then the sentence is changed to a red font color. This makes it easy to examine the document and discover which sentences exceed the length you specified.
There is a drawback to this macro, though: The .Count property for the Words collection counts punctuation as individual words. Thus, the sentence "Really, she asked." would have a count of 5 words, instead of the 3 expected, because there are two punctuation marks. If you don't want punctuation marks included in figuring out the sentence lengths, then the macro needs to be lengthened just a bit:
Sub MarkLong2()
Dim iMyCount As Integer
Dim iWords As Integer
Dim MySent As Range
Dim iWordCount As Integer
Dim sPunc As String
Dim J As Integer
iWords = 20 ' target word count
sPunc = ".,?!;:-" ' don't count these as words
iMyCount = 0
For Each MySent In ActiveDocument.Sentences
If MySent.Words.Count > iWords Then
iWordCount = 0
For J = 1 To MySent.Words.Count
If InStr(sPunc, Trim(MySent.Words(J))) = 0 Then
iWordCount = iWordCount + 1
End If
Next J
If iWordCount > iWords Then
MySent.Font.Color = wdColorRed
iMyCount = iMyCount + 1
End If
End If
Next MySent
MsgBox iMyCount & " sentences longer than " & _
iWords & " words."
End Sub
In this version, if the .Count property is greater than iWords, then a trimmed version of each word in the sentence is compared against a string of punctuation characters (sPunc). Only if the word is not within the punctuation string is it counted. It is this secondary count (iWordCount) that is finally compared against iWords and, if it is greater, the sentence is formatted as red.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11909) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Finding Long Sentences.
Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!
If you need to find some synonyms for a specific word in your document, here's how you can do it. (Hint: All you need to ...
Discover MoreSmart quotes can be helpful in giving your document a more finished look, but you may not want them after any of the ...
Discover MoreNeed to keep notes about a document, but you don't want others to see those notes either on-screen or on-paper? Here's an ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments