
Tips.Net > WordTips Home > Editing > Adding Quotes
Summary: This tip presents a handy little macro that adds quote marks around any selected text. The macro can be assigned to a shortcut key to make adding matching quote marks even faster. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
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.
Tip #9 applies to Microsoft Word versions: 97 2000 2002 2003
Step Up and Take Control! Subscribers to WordTips know just how valuable a resource it is. WordTips Premium provides twice the number of exceptional, easy-to-understand tips every week in an ad-free newsletter, as well as substantial discounts on WordTips archives and e-books.
Check out WordTips Premium today!
Learn to use styles and you discover the real power behind Word. Fast, easy, consistent document formatting and updating is within your grasp. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips