Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 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: Adding Quotes.

Adding Quotes

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


1

Normally, you add quote marks to your text as you type. There may be times, however, when you want to add the quote marks at a later time. For instance, while editing your document you may select some text and then want quote marks added around the selected text. You can accomplish this task with the following macro:

Sub AddQuotes()
    Dim sBegQ As String
    Dim sEndQ As String

    If Len(Selection.Range.Text) > 1 Then
        If Right(Selection.Range.Text, 1) = " " Then
            Selection.End = Selection.End - 1
        End If

        If Options.AutoFormatAsYouTypeReplaceQuotes Then
            sBegQ = Chr(147)
            sEndQ = Chr(148)
        Else
            sBegQ = Chr(34)
            sEndQ = Chr(34)
        End If

        Selection.InsertBefore sBegQ
        Selection.InsertAfter sEndQ
    End If
End Sub

The macro checks to make sure you have more than a single character selected. If so, then it makes sure the last character in the selection isn't a space, then determines the proper type of quote marks to use, based on whether you have Word's SmartQuotes turned on or not. The proper quotes are then placed before and after the selection.

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

Formatting Endnote Reference Marks

The reference marks used for endnotes are, by default, formatted "good enough" for most people. If you are one of those ...

Discover More

Showing Only Added Text with Track Changes

Do you want to change how Track Changes displays the markup in your document? Here's how you can completely hide deleted ...

Discover More

Deleting a Hyperlink

Hyperlinks can be helpful in some worksheets but bothersome in others. Here's how to get rid of any hyperlinks you don't ...

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 (ribbon)

Ctrl+V No Longer Works

One of the most commonly used keyboard shortcuts is CTRL+V, which is used to paste the contents of the Clipboard. If ...

Discover More

Capitals After Colons

Do you want Word to always capitalize the first letter appearing after a colon? The program won't do it by default, but ...

Discover More

Adding Half Spaces to Punctuation

Want a little more space just before some of your punctuation characters? You can add that spacing in a variety of ways, ...

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 one less than 9?

2021-11-27 10:35:39

Karen Schouest

Thanks so much for this macro, Allen. I love it! In addition to the original code to use for manually selected text, I have also modified it to add numerous versions to automatically select from one to five words to the left or right and add the quotes. I then added those shortcuts to my text expander (I use InstantText, but this shortcut will work with any text expander that allows the use of commands). So, for example, I press the IT shortcut ql3 plus my marker key (semicolon for me), and it runs the macro, which automatically selects the 3 words to the left of my cursor, adds the quotes, and then unselects the text. Likewise, ql2 selects 2 words ("q" for "quotation marks"; "l" for "left"), qr2 adds quotation marks to the 2 words to the right of the cursor, etc. That's quicker and easier than remembering and pressing the numerous shortcut keys. Super-quick and easy! I think anything beyond 5 words is just as quick to manually select it rather than keep counting the words, and in that case, I use the original AddQuotes macro. Easy-peasy. Thanks for another great macro! :)


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.