I've got a document that has some text colored red. Sometimes it's just a word, other times a sentence or paragraph. I seem to be able to loop Find.Execute the instances of red font okay. But, I'm not getting consistent results when I try to convert those to a custom Style. It works about 50% of the time.
Here's the code:
Dim r As Range Dim Fnd As Boolean Fnd = True Set r = ActiveDocument.Content r.Find.ClearFormatting r.Find.Font.Color = wdColorRed Do While Fnd = True With r.Find .Text = "" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With If Fnd = True Then r.Select Selection.Style = ActiveDocument.Styles("CustTxt") End If Loop