Sub ChangeColorWithReplace()
Selection.Find.ClearFormatting
Selection.Find.Font.Color = wdColorYellow
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorRed
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Кроме того, вот еще один способ сделать это.Это не очень быстро, но быстрее, чем делать это вручную:
Sub ChangeFontColorByCharacter()
Application.ScreenUpdating = False
Dim d As Document: Set d = ActiveDocument
For i = 1 To d.Characters.Count
If d.Characters(i).Font.TextColor.RGB = RGB(255, 255, 0) Then
d.Characters(i).Font.TextColor.RGB = RGB(255, 0, 0)
DoEvents
End If
Next
Application.ScreenUpdating = True
End Sub