by Allen Wyatt
(last updated November 1, 2014)
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, finding 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, and 2013.
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!
According to the normal rules of grammar, the word "spring" is not supposed to be capitalized. There may be times, ...Discover More
One of the mostly helpful tools that Word includes is a grammar checker. Sometimes, however, the grammar checker might ...Discover More
Are you bothered by the green underlines that Word uses to mark potential grammar errors in your document? You can hide ...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.