View Single Post
 
Old 11-13-2024, 12:04 PM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Shelly Lou,


Looks fine. I would do it like this using the Select statement:

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
Dim oChr As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Highlight = True
    While .Execute
      Select Case oRng.HighlightColorIndex
        Case Is = 9999999
          For Each oChr In oRng.Characters
            Select Case oChr.HighlightColorIndex
              Case wdBrightGreen, wdPink
              oChr.HighlightColorIndex = wdAuto
            End Select
          Next oChr
        Case Is = wdBrightGreen
          oRng.HighlightColorIndex = wdAuto
        Case Is = wdPink
          oRng.HighlightColorIndex = wdAuto
      End Select
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote