How to highlight a particular text in word document?


Working on the automation process of reviewing the word document against few rules. if certain sections are not as per rules, then need to highlight that part in word document.

Is that possible or feasible?

One way of doing it is as follows:

  1. Attach to Word document Window
  2. Ctrl+g to bring up the GoTo Dialog (as shown below)
  3. Attach to the Find and Replace Window (test if this really needed)
  4. Alt+d to switch to the Find Tab
  5. Type in the word to be found
  6. Alt+i to Find In
  7. M to select Find in Main document
  8. Alt+R to open the Reading Highlight
  9. H to highlight all the found words


1 Like

Thank you @AndyMenon This solution highlights all the occurrences of the word. But the requirement is to highlight only at a specific place where the rule is failing not at every occurrence.

Understood. But at the fundamental level, you do need a way to find those words first before you can analyze rules.

Conversely, if you need to highlight the words only in sections that are not compliant with your rules, then you will need a way to find only those sections first. Which loops us back into your original problem.

We can slightly alter the mechanism to do Find Next instead of Find All. In theory it would be.

  1. Type in word
  2. Find Word using Find Next
  3. Analyze section around the word (somehow)
  4. If rules invalidates the section, then highlight word
  5. If not return to step 2

You have to start with one or the other approach. Yes?

1 Like