将自动文本颜色替换为选择中的某些明确颜色

Replace automatic text color to some explicit color in selection

如何编写一个宏,找到所有带有 Font.ColorIndex = wdColorAutomatic 的文本块并将其更改为 wdColorWhite?

我需要它将富文本粘贴到 Confluence wiki 中的黑色背景面板。此背景的默认颜色为灰色。

试试这个:

Sub Test()
      With ActiveDocument.Range.Find
      .Text = "wdColorAutomatic"
      .Replacement.Text = "wdColorWhite"
      .Forward = True
      .Wrap = wdFindContinue
      .Format = False
      .MatchCase = False
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
      .Execute Replace:=wdReplaceAll
    End With
End Sub