basin
basin

Reputation: 4190

Replace automatic text color to some explicit color in selection

How to write a macro, which finds all blocks of text with Font.ColorIndex = wdColorAutomatic and changes it to wdColorWhite?

I need it to paste rich text to a panel with black background in Confluence wiki. Default colour for this background is grey.

Upvotes: 0

Views: 122

Answers (1)

Kᴀτᴢ
Kᴀτᴢ

Reputation: 2176

try this:

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

Upvotes: 1

Related Questions