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.
Written by Allen Wyatt (last updated December 17, 2019)
This tip applies to Word 97, 2000, 2002, and 2003
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:
Figure 1. The Replace tab of the Find and Replace dialog box.
["|"]*["|"]
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
Note:
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.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
The AutoFormat feature of Word can be configured to make changes to a variety of conditions in your document. Here's how ...
Discover MoreCreate a document in one version of Word on one machine and then open that document in a different version of Word on a ...
Discover MoreVertical lines are even easier to add around a word than are horizontal lines. There are a variety of methods you can use ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-02-13 16:06:34
Ef
Hi Allen, thank you for this helpful macro. However, in my case, the macro will end up formating the whole text following the first quote. How can I fix this?
Thank you again for your time and effort!
2018-11-05 21:33:19
Robert
Hi Allen,
This is exactly what I'm looking for, but I can't get it to work properly.
I want to Bold 45 terms in legal documents, but the above Sub only Boldens the first term.
I also tried the Find and Replace method, but get an Error on the \2\1| entry.
Could you please clarify how to to get the Sub to loop over and over again?
Thanks
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.
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments