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

Exactly Positioning Text

If you need to control exactly where text will appear on the page or relative to other text, you need to know about the ...

Discover More

IEEE Citation Format

Different style guides describe different ways of formatting information that appears in a document. One such style guide ...

Discover More

Repaginating Your Document in a Macro

When processing a document with a macro, you may need to have the macro repaginate the text. It's easy to do using the ...

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)

Keyboard Control of the Find and Replace Dialog Box

Hate to take your hands off the keyboard? This tip explains how you can use the keyboard to work with the Find and ...

Discover More

Searching for Optional Hyphens

If you have a document that contains optional hyphens (special characters that mark where a word can be split between ...

Discover More

Replacements Use an Incorrect Foreign Language Character

When using Find and Replace, it is possible that you might notice some surprising results when the replacements are done. ...

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 2 + 2?

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.