Written by Allen Wyatt (last updated July 10, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021
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:
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 2021.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
When you have Track Changes turned on for a document, Word remembers which editor made which changes. If this behavior ...
Discover MoreMany people, when collaborating on a document with others, use the Track Changes feature to show the effects of their ...
Discover MoreWhen a group of people edits a document with Track Changes turned on, it can be tempting for one of the editors to use ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2025-01-22 22:10:53
Myron
Hi again - never mind. I didn't see your response and solution to Nick's similar query. Your solution solved my problem. Sorry to bug you.
2025-01-22 22:06:03
Myron
Hello Allen - your macro on accepting deleted text has been a huge help in my work. However, this week it stopped working. When I ran the debug tool the error said the object could not be found and highlighted this part of the code: "If oRev.Type = wdRevisionDelete Then" . I'm hoping you can suggest a solution. I'm wondering if a Zotero plug-in might be interfering with it, but I would have no idea how that could happen. Installing the Zotero plug-in is just the last significant thing to change. Thanks for your time and assistance.
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?
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments