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: Adding Quotes.

Adding Quotes

Written by Allen Wyatt (last updated June 29, 2019)
This tip applies to Word 97, 2000, 2002, and 2003


5

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 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 Sub

The macro 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 (9) 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: 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

Finding the Size of Individual Worksheets

Your workbooks can contain many, many worksheets. Which of those worksheets are the largest, however? Here's some ideas ...

Discover More

Locking Lines in a TOC

Want to "lock down" the lines in a TOC so that you cannot add new paragraph marks in the middle of one? You may not be ...

Discover More

Creating See-Through Text Boxes

When laying out your document, you may want to use a text box that appears to be positioned over your text, but to be ...

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

Comparing Documents Top and Bottom

Word has a feature that allows you to compare two documents side-by-side. What if you actually want to compare the ...

Discover More

Using Manual Line Breaks with Justified Paragraphs

If you use justified paragraphs, you know that if you press Shift+Enter, it can lead to some odd spacing between words ...

Discover More

Replacing the Last Comma

When you need to perform certain editing tasks over and over again, you start to look for ways to make your work faster ...

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 two more than 7?

2022-02-01 17:18:56

Jonathan Anderson

Here is a Macro that encloses the selected text without enclosing leading or trailing spaces.

Sub encloseSelectionDoubleQuotesKeepSpaces()
'
' encloseSelectionDoubleQuotes Macro
' Chr(32) is the space character
Dim CFrst As String
Dim CLast As String
Dim Result As String
With Selection.Range
'Check for leading and trailing spaces
CFrst = Left(CStr(.Text), 1)
CLast = Right(CStr(.Text), 1)
If (CFrst = Chr(32)) Then
'include leading space
Result = Chr(32) & Chr(34) & Trim(.Text) & Chr(34)
Else
'exclude leading space
Result = Chr(34) & Trim(.Text) & Chr(34)
End If
If (CLast = Chr(32)) Then
'append with trailing space
Result = Result & Chr(32)
End If
'overwrite selected text with result
.Text = Result
End With
End Sub


2021-11-29 11:39:45

Phil Rabichow

Thank you Allen. I've changed the macro. It's strange though. I have the macro in a global template (Macros.dot), which loads when I start Word. If I open the template, select text in a document, go to the macro in the VBE, I can press F5 or F8 & the macro works perfectly.

If I, instead, press Alt+F8 & run the macro (or use the toolbar button that I assigned to the macro), it clips off the entire last word. e.g. here I selected
quick brown fox space
Here's the result: (see Figure 1 below)

Here are my edit settings: (see Figure 2 below)

Figure 1. 

Figure 2. 


2021-11-29 08:58:44

Allen

See the macro version over on the WordTipsRibbon site, Phil. (Link is in the gray box at the top of this page.) It includes logic to not include the space.

-Allen


2021-11-28 18:13:27

Phil Rabichow

Hi Allen:
I tried this macro, as well as your "Add Parens" macro. The trouble that I've had with both is that when I select text by double clicking & dragging my mouse, Word select both the words & the space after. The macros always place the final quote or paren after the space...i.e. it looks like this: "this is in quotes ", rather that this: "this is in quotes".


2019-09-30 13:35:17

Niki Pino

Do you know how to add quotes to multiple lines in MS Word? So that quotes are at the beginning of each new line after enter is pushed and at the end before enter is pushed?


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.

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.