Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Automatically Formatting Text within Quotes.

Automatically Formatting Text within Quotes

by Allen Wyatt
(last updated June 14, 2014)

4

Sandy asked how to find all text between quotation marks and format it to be bold. The solution needs to be able to handle multiple words between the quote marks—entire phrases that need to be bold. This is an interesting question, and there are several ways that it can be approached.

One approach is to use Word's powerful Find and Replace feature to do just what you need. Follow these steps:

  1. Choose Replace from the Edit menu. Word displays the Replace tab of the Find and Replace dialog box. (See Figure 1.)
  2. Figure 1. The Replace tab of the Find and Replace dialog box.

  3. In the Find What box, enter the following:
  4.      ["|"]*["|"]
    
  5. This must be entered just as it is, without spaces. The character after the first vertical bar is an opening smart quote, and the one after the second vertical bar is a closing smart quote. The smart quotes are entered in the dialog box by holding down the Alt key and typing 0147 on the keypad for the first one, and then 0148 for the second one.
  6. Move the insertion point to the Replace With box.
  7. Click on Format, then Font. Word displays the Replace Font dialog box. (You may need to click on the More button before you can see the Format button.)
  8. Click on Bold option in the Font Style list.
  9. Click on OK.
  10. Make sure the Use Wildcards check box is selected.
  11. Click on Replace all.

Notice that when Word is done with this search and replace, it will have bolded not only the text within the quotes, but the quotes themselves. If you want to change the quotes back to normal, you can do another wildcard search, this time looking for simply ["|"|"] (step 2, with the last two quotes being opening and closing smart quotes) and replacing it with Not Bold formatting (step 5).

It is interesting to note that you must search for ["|"]*["|"] and not simply for "*". The reason for this is quite simple. If you are getting your documents (the ones you are formatting) from someone else, you don't know right off the bat if they used smart quotes, regular quotes, or a combination of both. By using the brackets surrounding the two types of quotes on both sides of a vertical bar, you are telling Word to match with either type of opening or closing quote. When you have Use Wildcards selected, Word discriminates between regular and smart quotes. (It doesn't discriminate if you are using Search and Replace without wildcards turned on.)

If you need to do quite a bit of formatting of information between quotes in this manner, the best bet is to create a macro that you can then add to a menu choice or a toolbar button. Perhaps the easiest way is to simply use the macro recorder to record the above steps. If you prefer, you can utilize the following VBA macro to do the trick:

Sub BoldBetweenQuotes()
' base for a quotes finding macro
    Dim blnSearchAgain As Boolean
    ' move to start of doc
    Selection.HomeKey Unit:=wdStory
     ' start of loop
    Do
        ' set up find of first of quote pair
        With Selection.Find
            .ClearFormatting
            .Text = Chr(34)
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindStop
            .Execute
        End With
        If Selection.Find.Found Then
            Selection.MoveRight Unit:=wdCharacter, Count:=1
            ' switch on selection extend mode
            Selection.Extend
            ' find second quote of this pair
            Selection.Find.Execute
            If Selection.Find.Found Then
                Selection.MoveLeft Unit:=wdCharacter, Count:=1
                ' make it bold
                Selection.Font.Bold = True
                Selection.Collapse Direction:=wdCollapseEnd
                Selection.MoveRight Unit:=wdCharacter, Count:=1
                blnSearchAgain = True
            Else
                blnSearchAgain = False
            End If
        Else
            blnSearchAgain = False
        End If
    Loop While blnSearchAgain
End Sub

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1500) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Automatically Formatting Text within Quotes.

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

Figuring Out the Low-Score Winner

Need to figure out the lowest score in a range of scores? Here's the formulas to get the information you need.

Discover More

Creating Add-Ins

Want to create your own add-in? Excel makes it easy to do. Here are all the steps you need.

Discover More

Setting Tab Stops Using the Tabs Dialog Box

Aligning different lines in your document is easy. Using the tab stops feature in Word, you can set four different types of ...

Discover More

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!

More WordTips (menu)

Extending a Paragraph into the Left Margin

Word allows you to format a paragraph so that it extends into the left margin of the document. This is done by setting a ...

Discover More

Eliminating "Before Spacing" at the Top of a Page

When formatting paragraphs in Word, you have several options to adjust the spacing before, within, and at the end of each ...

Discover More

Copying Formats

Want to copy a format from one place to another without taking your hands off the keyboard? It's easy to do if you apply the ...

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}] 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 6 + 0?

2015-04-06 11:38:09

Kara

The above works great! However, I am trying find some code that would apply bold to text inside both quotes and parentheses. See below.

Quick Styles (“Quick Styles”) gallery

The macro here stops at text inside of quotes in a parentheses. Any help would be appreciated.


2015-04-05 00:34:54

Dave M

How would you modify the above macro if there were other characters you wanted to format between? I'm proofreading a friend's book and there are passages he uses double carats to designate emphasis and I would like to use a macro to italicize between them.

E.g.
<< John did stuff. >>

becomes

<< <i> John did stuff. </i> >>


2014-10-14 18:55:00

Kim Chrisom

Can you do this with underlining? I got it to work with Bold and Italics, but not underlining and would LOVE to be able to do that on large documents. Thanks in advance.


2014-08-24 13:36:26

Lucy

Many Thanks!!! This worked like a charm.


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
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.