When you collaborate on a Word document with multiple reviewers, tracked changes can sometimes become orphaned. Orphan tracked changes are revisions that appear in the document but no longer have a visible comment or author attribution in the standard Reviewing Pane. This typically happens when comments are deleted but the underlying revision marks remain, or when changes are imported from different document versions. You cannot remove these orphan marks using the Accept or Reject buttons in the Review tab because Word does not recognize them as active changes. This article explains how to identify orphan tracked changes and remove them using a VBA script that forces Word to clear all residual revision data.
Key Takeaways: Cleaning Orphan Tracked Changes With VBA
- VBA macro method: ActiveDocument.Revisions.AcceptAll and ActiveDocument.Revisions.RejectAll: These commands force Word to process all revision marks including orphan entries that the UI ignores.
- Reviewing Pane visibility check: Open the Reviewing Pane to confirm that orphan changes exist before running the script.
- Macro security setting File > Options > Trust Center > Trust Center Settings > Macro Settings > Enable all macros: You must temporarily allow macros to run the script.
Why Orphan Tracked Changes Occur and How VBA Detects Them
Orphan tracked changes are revision marks that remain in the document XML but are not displayed in the standard Track Changes balloon view. They occur when a reviewer’s user profile is removed from the system, when comments are stripped during document conversion, or when changes are pasted from another document that had tracked changes enabled. Word’s graphical interface relies on author metadata to group and display revisions. When that metadata is missing or corrupted, the Accept and Reject commands on the Review tab may skip those orphan entries.
VBA provides direct access to the document’s Revisions collection. The ActiveDocument.Revisions object contains every revision mark regardless of its display state. By iterating through this collection programmatically, you can accept or reject all revisions, including orphans that the UI ignores. The script does not depend on author names or comment data. It processes every revision entry in the document’s underlying storage.
What Counts as an Orphan Tracked Change
An orphan tracked change has one or more of these characteristics:
- The revision appears in the document as strikethrough or underline but does not show up in the Reviewing Pane vertical bar.
- The revision has no author name or date in the Reviewing Pane detail view.
- The revision cannot be selected by clicking on it in the document body.
- The Accept All Changes command on the Review tab does not remove the formatting or text change.
Steps to Clean Orphan Tracked Changes Using a VBA Script
Before running the script, save a copy of your document. The VBA macro permanently accepts or rejects all revisions including orphan marks. You cannot undo this action after saving and closing the file.
Step 1: Enable Macros in Word
- Open Word Options
Click File > Options > Trust Center. Click Trust Center Settings. - Change macro settings
Select Macro Settings. Choose Enable all macros. Click OK twice to close the dialogs.
Step 2: Open the VBA Editor
- Press Alt+F11
This opens the Visual Basic for Applications editor window. - Insert a new module
In the editor, click Insert > Module. A blank code window appears.
Step 3: Paste the VBA Script
- Copy the macro code
Copy the following script exactly:Sub CleanOrphanRevisions() Dim rev As Revision Dim doc As Document Set doc = ActiveDocument ' Accept all revisions including orphans doc.Revisions.AcceptAll ' Reject any remaining revisions that could not be accepted doc.Revisions.RejectAll MsgBox "All tracked changes including orphan marks have been removed." End Sub - Paste into the module
Click inside the module window and press Ctrl+V to paste the code.
Step 4: Run the Macro
- Execute the script
Press F5 while the cursor is inside the macro code. Alternatively, click Run > Run Sub/UserForm. - Confirm the action
Word processes all revisions. A message box appears when the macro finishes. Click OK.
Step 5: Verify the Document
- Check the Reviewing Pane
On the Review tab, click Reviewing Pane. The pane should show zero revisions. - Save the document
Press Ctrl+S to save the cleaned version. Use a new file name to keep the original backup.
If the VBA Script Does Not Remove All Orphan Marks
In some cases, the AcceptAll and RejectAll commands may skip revisions that are locked by document protection or that exist in nested subdocuments. The following sections address these specific scenarios.
The Document Is Protected for Tracked Changes Only
If the document has been set to force tracked changes, you cannot accept or reject revisions programmatically. To remove protection:
- Open the Restrict Editing pane
Click Review > Restrict Editing. - Stop protection
Click Stop Protection. If prompted, enter the password. - Run the macro again
Repeat steps in the main section above.
Orphan Marks Exist in a Master Document With Subdocuments
The macro runs only on the active document. Subdocuments are separate files. To clean all orphans:
- Expand all subdocuments
On the View tab, click Outline. In the Outlining tab, click Expand Subdocuments. - Run the macro on each subdocument
Open each subdocument file individually and run the macro.
Word Displays a Compile Error When Running the Macro
A compile error usually means the VBA project is blocked by security settings or the code contains a typo. Verify that macros are enabled per Step 1. Check that the code is pasted exactly as shown with no extra characters. If the error persists, restart Word and try again.
Manual Clean vs VBA Script: Key Differences
| Item | Manual Clean | VBA Script Clean |
|---|---|---|
| Method | Review tab > Accept All Changes | ActiveDocument.Revisions.AcceptAll and RejectAll |
| Handles orphan marks | No | Yes |
| Requires macro enablement | No | Yes |
| Undoable after save | No | No |
| Works on protected documents | No | No (must remove protection first) |
| Works on subdocuments | No | No (must run per file) |
You can now remove orphan tracked changes from any Word document using the VBA script provided. Before running the macro on a critical file, always test it on a copy. For documents that contain a mix of legitimate and orphan revisions, consider using the AcceptAll command only and then manually reviewing the remaining marks. An advanced tip: modify the script to loop through each revision and log its author and date to a text file before accepting, giving you a record of what was removed.