Dim xRev As Revision
For Each xRev In ActiveDocument.Revisions
If Left(xRev.FormatDescription, 12) = "Mis en forme" Then
If you have a Word document which is in track changes mode, when you apply the Accept All Changes feature, all the track changes will be accepted. But, sometimes, you just want to accept the formatting track changes without accepting the insertions or deletions. This article will talk about how to solve this task in Word document.
The following VBA code can help you to accept the formatting track changes only in Word document, please do as this:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. And then, click Insert > Module, copy and paste below code into the opened blank module:
VBA code: Accept format track changes only in Word document
Sub AcceptFormatChanges() Dim xRev As Revision For Each xRev In ActiveDocument.Revisions If Left(xRev.FormatDescription, 10) = "Formatted:" Then xRev.Accept End If Next End Sub
3. And then press F5 key to run this code, and only the formatting track changes have been accepted in the active Word document immediately. See screenshot:
In Word document, you can also apply the Show Markup function to finish this job, please do with following steps:
1. In the track changes mode file, click Review > Show Markup, and then uncheck the Comments and Insertions and Deletions options, and leave the Formatting option checked, see screenshot:
2. And now, you just can see the formatting tracked changes, then, go on clicking Review > Accept > Accept All Changes Shown as following screenshot shown:
3. And all the formatting track changes have been accepted, now, you need to return on the Comment, Insertions and Deletions options by checking them from the Show Markup drop down list, see screenshot:
4. Now, you can see the formatting track changes have been accepted, and other track changes are still kept, see screenshot: