Converting Text Inside Double Asterisks to Bold

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


6

David has information that he's imported into Word. The information is plain text, and anything that is supposed to be bold is surrounded by double asterisks, as in **this should be bold**. David wonders if there is an easy way to convert this double-asterisk convention into actual bold text.

This can be accomplished relatively easily using Find and Replace, as long as you do your searching and replacing with the aid of wildcards. Follow these steps:

  1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is available. Word expands the Find and Replace dialog box. (See Figure 1.)
  3. Figure 1. The expanded Find and Replace dialog box.

  4. Make sure the Use Wildcards check box is selected.
  5. Enter the following in the Find What box: \*\*(*)\*\*
  6. Enter the following in the Replace With box: \1
  7. With the insertion point still in the Replace With box, click the Format button and then choose Font. Word displays the Replace Font dialog box. (See Figure 2.)
  8. Figure 2. The Replace Font dialog.

  9. Using the Font Style list, choose Bold.
  10. Click OK to dismiss the Replace Font dialog box. You should notice the phrase Font: Bold appears under the Replace With box.
  11. Click on Replace All.

What happens is that Word finds all instances of text within double asterisks, deletes the asterisks, and formats the text as bold. This is done because of the pattern you entered in the Find What box (step 4). The backslashes just before each asterisk cause Word to treat them as actual characters, not as wildcards—which asterisks normally are. The \1 in the Replace With box (step 5) indicates that you want to replace the matched text with whatever is within the first set of parentheses in the Find What box. That asterisk within the parentheses does not use a backslash, so it is a wildcard that matches any text.

The steps to perform the changes are easy to accomplish, but if you do this type of replacement quite a bit, you should consider using a macro to perform the task. You can do so by using the Macro Recorder while you perform the above steps. The macro will look very similar to this:

Sub BoldDoubleAsterisks
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Bold = True
    With Selection.Find
        .Text = "\*\*(*)\*\*"
        .Replacement.Text = "\1"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Run the macro, and all the double-asterisk enclosed text in the document is affected. You can also assign the macro a shortcut key or add it to the Quick Access Toolbar to make it more accessible.

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 (11222) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

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

Protecting Worksheets

Excel allows data protection for particular cells or a whole worksheet in a shared work environment. Here's how to apply ...

Discover More

Setting the AutoRecover Directory

Excel, by default, periodically writes information to AutoRecover files that can help protect your data in case Excel is ...

Discover More

Updating Automatically when Opening Under Macro Control

If your workbook contains links, you are normally given the opportunity to update those links when you open the workbook. ...

Discover More

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!

More WordTips (ribbon)

Using Find and Replace to Change Text Case

Can you really use Find and Replace to change the case of text in your document? Not really, but that shouldn't stop you ...

Discover More

Selectively Find and Replace Page Borders

Using Find and Replace you can both find and replace graphics in your document. Replacing graphics selectively is a bit ...

Discover More

Changing Formatting for a Portion of Found Text

The Find and Replace capabilities of Word are quite powerful. If you want to change the formatting of just a part of text ...

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?

2024-09-25 22:05:47

Todd

Thanks for posting this guide! I found it helpful in formatting a document generated by AI.

Have a great day.

Todd


2024-07-20 09:49:13

Kirk Livingston

Allen, thanks very much for this. It is super helpful.


2024-05-22 13:39:54

Mohammed naeem

Thanks a lot for your hard work, I really appreciate!
Thanks again.

Mohammed Naeem


2024-02-24 14:38:27

Tomek

Correction:
rather than deleting the line
    .Wrap = wdFindContinue
you should change it to
     .Wrap = wdFindStop

The reason is that this setting is remembered by Word, hence deleting the line may give unexpected results.


2024-02-24 14:24:08

Tomek

Just a caveat:
You have to make sure that when you start the Search-Replace, the cursor is at the very beginning of the document, or at least not between the two double stars marking the text to be bold. Otherwise the process may convert the text that was not to be bold into bold - opposite to what you want.
The same applies when you run the macro, but you can add the following line of code at the beginning of the macro to start at the beginning of the document:
    Selection.HomeKey Unit:=wdStory

The macro as written in the tip will convert the text between double-asterisk marks into bold in the whole document, even if you start with just a selection of text. This is controlled by the line:
    .Wrap = wdFindContinue
You can delete this line if you want the conversion only to apply to the selected text. The caveat still applies.

I propose a slightly modified macro, which will process the whole document starting at the beginning, if the selection is just the insertion point, otherwise it will only process the selected text. This macro can also be run on a header or footer.
-------------------------------
Sub BoldDoubleAsterisksinSelection()
    If Selection.Type = wdSelectionIP Then Selection.HomeKey Unit:=wdStory

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Bold = True
    With Selection.Find
        .Text = "\*\*(*)\*\*"
        .Replacement.Text = "\1"
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub


2024-02-24 04:47:59

Leanne Bentley

I’d love more wild card tips. I use this one a lot.


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.