Skip to main content

How to bold all instances of the same word in a Word document?

If there are multiple “outlook” texts in your Word file, now you need to format all the “outlook” texts as bold. How could you bold all instances of the same word in a large Word document as quickly as possible?

Bold all instances of the same word in a Word document with VBA code


Bold all instances of the same word in a Word document with VBA code

The following VBA code can help you to bold all instances of a specific word quickly and easily, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. And then, click Insert > Module, copy and paste below code into the opened blank module:

VBA code: Bold all instances of the same word

Sub BoldAll()
    Dim xStr As String
    xStr = InputBox("Please enter the word that you want to bold:", "KuTools for Word")
    If Trim(xStr) = "" Then
        MsgBox "Cann’t be empty!", vbInformation, "KuTools for Word"
    End If
    With ActiveDocument.Content.Find
        .ClearFormatting
        .Text = xStr
        .Replacement.ClearFormatting
        .Replacement.Font.Bold = True
        .Replacement.Text = "^&"
        .Wrap = wdFindStop
        .Format = True
        .Forward = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub

3. After inserting the code, and then press F5 key to run it, and a dialog box is popped out to remind you inserting the word that you want to bold, see screenshot:

doc bold specific word 1

4. And then, click OK button, and all the specific words have been formatted as bold at once.

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Inquire for Information based on Document, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to our Remove Group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert Group...

🔍 Precision Selections: Pinpoint specific pages  /  tables  /  shapes  /  heading paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate swiftly to any location  /  auto-insert repetitive text  /  seamlessly toggle between document windows  /  11 Conversion Tools...

👉 Want to try these features? Kutools for Word offers a 60-day free trial, with no limitations! 🚀
Free Download     Read More     Buy Now
 
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Que isso, salvou meu dia no escritório. Muito obrigado!
This comment was minimized by the moderator on the site
Using Google Translate, this is what Stef had said,
"Hello and thank you for this piece of VBA code.

I work on documents that contain keywords explained like this <#myKeyword>
I would like to identify and bold all the elements that are between < and >.

Is this possible in VBA and could you guide me?

Best to you. (A friendly regard used between people who exchange services or information.)

Stef"

Separately, I, Kaitlyn, was wondering if I could use code to bold all questions.
This comment was minimized by the moderator on the site
Bonjour et merci pour ce bout de code VBA.

Je travaille sur des documents qui contiennent des mots clés explicités de la sorte <#monMotClé>
je souhaiterais repérer et mettre en gras tous les éléments qui se trouvent entre < et >.

est-ce que cela est possible en VBA et pourriez vous me guider ?

Bien à vous.

Stef
This comment was minimized by the moderator on the site
Hello, Stef,
Sorry, I can't understand your question clearly, could you explain your problem in English?
Thank you!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations