A Microsoft Word VBA macro. When you click on a word and run the macro, it highlights all instances of that word in the document. Click again to remove the highlighting.
- Highlight all instances of a word by clicking on it
- Works with selected phrases (multiple words)
- Toggle highlighting on/off with second click
- Yellow highlighting (can be modified in the code)
- Matches whole words only to avoid partial matches
- Open Microsoft Word
- Press Alt + F11 to open the Visual Basic Editor
- In the Project Explorer (left side), right-click "Modules"
- Select Insert > Module
- Copy and paste the contents of
HighlightSameWords.vba
into the new module - Save and close the VBA editor
- Add to the ribbon or as a keyboard shortcut as you please
- Click anywhere in a word or select multiple words
- Either:
- Run the macro from the Macros menu (View > Macros)
- Or press your assigned keyboard shortcut
- Click the same word and run the macro again to remove highlighting