View Single Post
 
Old 06-07-2018, 07:39 AM
musicgold musicgold is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Jun 2018
Posts: 3
musicgold is on a distinguished road
Default Highlighting multiple non-contiguous words?

Hi,

I use the following code to highlight a selected word, or line or paragraph.

However, when I select two or more non-contiguous words (by keeping the CTRL key pressed), and apply this macro, it only highlights the last selected word.

What can I do to get the macro to highlight all of selected words?


Code:
  Selection.Expand Unit:=wdWord
  Selection.Range.HighlightColorIndex = wdYellow
  Selection.MoveRight Unit:=wdCharacter, Count:=1
Thanks
Reply With Quote