View Single Post
 
Old 07-05-2022, 11:11 AM
JTell JTell is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2022
Posts: 5
JTell is on a distinguished road
Default Create Word macro to delete text throughout the entire document

I need to create a macro that will turn on change tracking, delete all text that is formatted with red/underline, and then turns off change tracking. I have the macro working for one block of text at a time, but I'd like it to loop through the entire document.
I played a bit with Do Until loops, but this is my first time using Macros in Word and I suspect I am just not experienced enough to get it working... any help is appreciated.

Code:
Sub ClearRed()
'
' ClearRed Macro
'
'
ActiveDocument.TrackRevisions = True
Selection.Find.ClearFormatting
With Selection.Find.Font
.StrikeThrough = True
.DoubleStrikeThrough = False
.Color = wdColorRed
End With
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveDocument.TrackRevisions = False
End Sub
Reply With Quote