![]() |
#4
|
||||
|
||||
![]()
The Execute ReplaceAll command doesn't track the formatting change so you need to loop that step.
Code:
Sub Macro1() Dim aRng As Range, aRng2 As Range ActiveDocument.TrackRevisions = True ActiveDocument.TrackFormatting = True Set aRng = Selection.Range Set aRng2 = aRng.Duplicate With aRng.Find .ClearFormatting .Font.Color = wdColorRed .Text = "" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False Do While .Execute = True aRng.Font.ColorIndex = wdBlack aRng.End = aRng2.End Loop End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jec1 | Word VBA | 2 | 12-04-2019 11:32 PM |
Macro to change an RGB table cell shading color to another RGB color | David Matthews | Word VBA | 4 | 05-29-2018 02:45 PM |
![]() |
BABZ | Word VBA | 1 | 01-09-2017 10:33 PM |
![]() |
joewoods | Word VBA | 13 | 05-16-2016 06:29 PM |
Word macro doesn't change font color | Spideriffic | Word VBA | 8 | 11-04-2015 03:47 AM |