Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. 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: Automatically Formatting Text within Quotes.

Automatically Formatting Text within Quotes

Written by Allen Wyatt (last updated April 27, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


1

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. Press Ctrl+H. 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.      ["|"]*["|"]
    

    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.

  5. Move the insertion point to the Replace With box.
  6. 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.)
  7. Click on Bold option in the Font Style list.
  8. Click on OK.
  9. Make sure the Use Wildcards check box is selected.
  10. 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 assign to a shortcut key or to the Quick Access Toolbar. Perhaps the easiest way is to simply use the macro recorder to record the above steps. If you prefer, you can utilize the following macro to do the trick:

Sub BoldBetweenQuotes()
    Dim blnSearchAgain As Boolean
    Dim sSearch As String

    sSearch = "[" & Chr(34) & "|" & Chr(147) & "]"
    sSearch = sSearch & "*"
    sSearch = sSearch & "[" & Chr(34) & "|" & Chr(148) & "]"

    Selection.HomeKey Unit:=wdStory
    Do
        With Selection.Find
            .ClearFormatting
            .Text = sSearch
            .Replacement.Text = ""
            .MatchWildcards = True
            .Forward = True
            .Wrap = wdFindStop
            .Execute
        End With
        If Selection.Find.Found Then
            Selection.MoveStart unit:=wdCharacter, Count:=1
            Selection.MoveEnd unit:=wdCharacter, Count:=-1
            Selection.Font.Bold = True
            Selection.Collapse Direction:=wdCollapseEnd
            Selection.MoveRight unit:=wdCharacter, Count:=1
            blnSearchAgain = True
        Else
            blnSearchAgain = False
        End If
    Loop While blnSearchAgain

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 (8436) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word 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

Selecting Multiple Cells by Mistake

Click on a cell and you expect the single cell to be selected. If you instead get a group of cells, it can be frustrating ...

Discover More

Finding the Last-Used Cell in a Macro

Ever wonder what the macro-oriented equivalent of pressing Ctrl+End is? Here's the code and some caveats on using it.

Discover More

Fast Spelling Corrections

Want to correct the spelling of a word that Word thinks is improperly spelled? A quick way to do it is to right-click the ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Adjusting the Width of Characters

Need to adjust how your characters look horizontally? Word provides an easy way you can scale the horizontal appearance ...

Discover More

Engraving and Embossing Text

Word allows you to format your text in a number of different ways. Two rather esoteric ways to format your text are by ...

Discover More

Changing Strikethrough Lines

Want to change the way a strikethrough line appears? It's not as easy as you think, as you find out in this tip.

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 five more than 6?

2024-04-28 07:51:49

Barry

Hi.
First can someone please explain the function of the vertical bar -- | -- character in the search criteria. I thought the square brackets -- [ ] -- denoted 'Find any one of the characters enclosed' between them.

Also, I had a similar issue but wanted the quotes removed, but the original text formatted in bold. The quotes in the imported text included single, double, and smart quotes.
After a bit of a struggle I came up with Find what: [‘|"|“](*)["|”|’] this eventually worked after I discovered than within my Word document the single quote mark is char: 8216 & 8217 but in the Find what box, typed from the keyboard it is char : 039. Once I used Copy & Paste from the document to the Find what box all was fine!
I assumed that 8216/7 was for smart single quotes but changing the auto format in the Word Options dialog didn't seem to change anything.
Any observations/explanations greatly appreciated.
Beepee


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.