Skip to content

Instantly share code, notes, and snippets.

@githubyouser
Created September 27, 2022 17:20
Show Gist options
  • Save githubyouser/752df995b031c88c896cd480a00cbccb to your computer and use it in GitHub Desktop.
Save githubyouser/752df995b031c88c896cd480a00cbccb to your computer and use it in GitHub Desktop.
Convert Tracked Changes in MS Word to Formatted Text
'Source: https://answers.microsoft.com/en-us/msoffice/forum/all/word-2013-is-there-a-way-to-replace-tracked/adc5f04e-34d5-4423-b0ac-84d5548246be
Sub ConvertTrackedChangesToFormatting()
'Add undo function - https://docs.microsoft.com/en-us/office/vba/word/Concepts/Working-with-Word/working-with-the-undorecord-object
Dim objUndo As UndoRecord
Set objUndo = Application.UndoRecord
'Begin the custom undo record and provide a name for the record
objUndo.StartCustomRecord ("Convert Tracked Ch. to Formatting")
Dim arev As Revision
For Each arev In ActiveDocument.Revisions
With arev
If .Type = wdRevisionDelete Then
With .Range.Font
.ColorIndex = wdRed
.StrikeThrough = True
End With
.Reject
ElseIf .Type = wdRevisionInsert Then
With .Range.Font
.ColorIndex = wdRed
End With
.Accept
End If
End With
Next
'End the custom undo record
objUndo.EndCustomRecord
End Sub
@githubyouser
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment