Macro to Highlight the Selected Text in Microsoft Word?

I'm trying to trigger the highlight function in word, via a keyboard trigger. I don't like having to use the mouse for a common function. I'm being stymied because MS doesn't consider highlighting a command that I give a shortcut to. Is there a clever way to use the ribbon? (Short of recording a macro).

Hey Mark,

Yep. Look here:

A working macro is:

Sub Highlight_Selected_Text()
    CurColor = Options.DefaultHighlightColorIndex
    Application.ActiveDocument.Application.Options.DefaultHighlightColorIndex = CurColor
    Selection.Range.HighlightColorIndex = CurColor
End Sub

BUT – you don't have to write a macro. The highlight command is available in the Word-Menu-Bar > Tools > Customize Keyboard...

You can directly assign it a keyboard shortcut in Word.

Other choices are:

-Chris

Chris - thanks I had forgotten to look on StackOverflow. Funny since I’ve been back on a MacOS my StackOverflow brain seems to have been disabled.

I wasn’t able to find the highlight command in the customize keyboard, I will check again in a few minutes.

FWIW A few minutes of fighting with word helped me find it in the Customize Keyboard list. Danke - Mark

1 Like