View Single Post
 
Old 03-27-2023, 05:01 PM
syl3786 syl3786 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
First, while a common mistake, I am not Gmayor.


If you want to get rid of red highlighting in a mix of red and some other color:

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
            If oChr.HighlightColorIndex = wdRed Then
              oChr.HighlightColorIndex = wdAuto
            End If
          Next
        Case Is = wdRed
          oRng.HighlightColorIndex = wdAuto
      End Select
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
or like this:


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
    .Text = "*"
    .MatchWildcards = True
    .Highlight = True
    While .Execute
      Select Case oRng.HighlightColorIndex
        Case Is = wdRed
          oRng.HighlightColorIndex = wdAuto
      End Select
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
I deeply apologize for called the wrong name. I made a mistake. Thank you so much for your help! They works well!
Reply With Quote