by Allen Wyatt
(last updated May 25, 2020)
David is a writer and he uses Word's spelling, style, and grammar checkers a lot. Sometimes he finds that Word's suggestions, for correcting grammar, are bad and he has learned to ignore them. One thing that he has trouble with is the use of quotation marks around dialogue. Word doesn't recognize if David has left off a quotation mark at the end or beginning of a sentence. He remembers using a word processing program years ago that left green quotation marks on your document to indicate a missing quotation mark. He wonders if Word can be made to recognize missing quotation marks.
There is no way to do this natively within Word. The reason probably boils down to the fact that it is almost impossible to determine where a quote should begin and end. For instance, if you have a paragraph that contains four sentences and you place a quote mark somewhere within that paragraph, how is Word to determine whether that mark designates the beginning or end of a quote? If it is the beginning, how would Word know if the ending mark should be at the end of the sentence, the end of the second sentence, or the end of the paragraph? (The same conundrum occurs if the quote is the ending quote, but the placement perplexity extends to the left instead of the right.)
Combine this potential confusion with the fact that the closing quote mark might not even be in the current paragraph—it could be at the end of some later paragraph when the dialog being marked actually ends.
You could, however, develop a macro that would do at least some elementary checking for you. The following macro jumps to the beginning of the document and searches for the first quote mark. It then examines everything from that character to the end of the paragraph. If you are using non-smart quotes, it basically checks to see if there are an even number of quote marks. If you are using smart quotes, then it checks to see if there is an ending quote for each starting quote. If either condition is found to be false, then the text is highlighted.
Sub MarkUnevenQuotes() Dim sRaw As String Dim iNorm As Integer Dim iSmart As Integer Dim J As Long Selection.HomeKey Unit:=wdStory Application.ScreenUpdating = False Selection.Find.ClearFormatting With Selection.Find .Text = """" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute While Selection.Find.Found Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend sRaw = Selection.Text iNorm = 0 iSmart = 0 For J = 1 To Len(sRaw) If Mid(sRaw, J, 1) = Chr(34) Then If iNorm > 0 Then iNorm = iNorm - 1 Else iNorm = iNorm + 1 End If End If If Mid(sRaw, J, 1) = Chr(147) Then iSmart = iSmart + 1 End If If Mid(sRaw, J, 1) = Chr(148) Then iSmart = iSmart - 1 End If Next J If iNorm > 0 Or iSmart > 0 Then Selection.Range.HighlightColorIndex = wdYellow End If Selection.Collapse Direction:=wdCollapseEnd Selection.Find.Execute Wend Selection.HomeKey Unit:=wdStory Application.ScreenUpdating = True End Sub
When the macro is done, what you end up with is a bunch of text selections highlighted if they need to be visually checked. The macro won't, however, find ending quotes that are outside the paragraph in which the first quote occurs.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13293) applies to Microsoft Word 2007, 2010, 2013, 2016, and Word in Office 365.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
Word provides some handy document analysis that can help improve your writing. One such tool is the readability ...Discover More
When Word checks the grammar it thinks you are using in your prose, it follows a set of rules. Fortunately, the program ...Discover More
Word's grammar checker can helpfully mark grammar goof-ups as you type. When you pass your document on to another person, ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.