How to bold a specific word using VBA MS Word

Munir Ahamed 1 Reputation point
2022-09-16T10:31:51.843+00:00

Please share code

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,519 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points MVP
    2022-11-08T20:27:50.333+00:00

    .find is a clue.
    Simple look 1st in document:

      Selection.WholeStory  
      Selection.Find.Execute "your_word"  
      Selection.Font.Bold = True  
    

    or loop for more your_words

    Dim w As Range  
    For Each w In ActiveDocument.Words  
          If Trim(w.Text) = "your_word" Then w.Font.Bold = True  
    Next  
    

    Regards

    0 comments No comments