How to set and reset track changes using Word VBA

Word VBA Set / Reset TrackRevisons

When you create a macro to do some operations that are not concerned with the content of the document, it is always advisable to do it without track changes. It is also better to turn-off the changes on screen as the deleted text might interfere with the process.

When you turn off the TrackRevisons and ShowRevisions, it is always best to leave them in their old state after the operation.

The following code does exactly the same

Sub SetAndReset_TrackRevisions()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Dim bTrackRevFlag As Boolean

Dim bShowRevFlag As Boolean

bTrackRevFlag = ActiveDocument.TrackRevisions

ActiveDocument.TrackRevisions = False

ActiveDocument.ShowRevisions = False

' Do Some Operations

Call TagDocument

ActiveDocument.TrackRevisions = bTrackRevFlag

ActiveDocument.ShowRevisions = bShowRevFlag

End Sub

The VBA code for autotagging the document switches off the tracking and resets them to their original position after the TagDocument subroutine is executed