Created
September 27, 2022 17:20
-
-
Save githubyouser/752df995b031c88c896cd480a00cbccb to your computer and use it in GitHub Desktop.
Convert Tracked Changes in MS Word to Formatted Text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://stackoverflow.com/questions/34280088/ms-word-macro-for-converting-track-changes-markup-into-text for a more robust method.