Accepting All Deletions in a Document

Written by Allen Wyatt (last updated July 10, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


2

Mitch uses Track Changes in his documents quite a bit. He knows how to accept or reject changes. He's wondering, though, if there is a way to accept a complete subset of changes, such as accepting all deletions in the document, without affecting any other tracked changes.

This can be done, but only by using a macro. Fortunately, VBA allows you to access the revisions made in your document, as long as they were made with Track Changes turned on. The following macro steps through each revision and, if it is a deletion, it accepts that revision:

Sub AcceptDeletions()
    Dim oRev As Revision

    For Each oRev In ActiveDocument.Revisions
        If oRev.Type = wdRevisionDelete Then oRev.Accept
    Next oRev
End Sub

Note that there are two key elements in this macro. First, is the value stored in the .Type property. Word actually allows 22 different types of revisions, as detailed in this WordTip. As shown in the example above, the macro checks only to see if the .Type property indicates that the revision is, in fact, a deletion.

The second key element is the .Accept method. This causes the revision to be accepted, but you could just as easily specify the .Reject method, which would cause the revision to be rejected.

Finally, you should note that after running the macro, all deletions will be accepted in the document, but you won't be able to use Ctrl+Z to undo the effects of the macro.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13881) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

AutoFormat within Form Fields

When entering information into protected form fields, Word doesn't apply the formatting inherent in the AutoFormat As You ...

Discover More

Labeling X-Y Scatter Plots

Figuring out how to get the data points in an X-Y scatter plot labeled can be confusing; Excel certainly doesn't make it ...

Discover More

Field Reference to Number of Prior Pages

Fields are used for all sorts of purposes in Word, but typically to provide some sort of dynamic information. This tip ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Using Track Changes

Track Changes is a valuable Word tool that allows you to automatically mark changes in your document. This is a great ...

Discover More

Showing Only Added Text with Track Changes

Do you want to change how Track Changes displays the markup in your document? Here's how you can completely hide deleted ...

Discover More

Consolidating Changes under a Single User

When using Track Changes, you may want to have your edits appear to be those of a different user. Here's how to fool Word ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 8?

2023-07-28 09:21:08

Andrew

Nick, the simple way if you don't want to get into the programming of it is to insert the line "On Error Resume Next" in the line before the "For" statement, understanding that some Deletions may be skipped in the process

The not-so-simple way is to enter the debugger to investigate why the error occurred. My guess is that this is one of those situations where the loop ought to be run backward through the collection.

Andy.


2023-07-27 07:27:35

Nick

I get the message "Run-time error 5852: Requested Object is not Available".

In the debugger, the following line is highlit:

If oRev.Type = wdRevisionDelete Then


Any thoughts on what I need to change?


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.