Word VBA: Checking Track Changes

This Word VBA macro checks the track changes.

Macro Example

Sub CheckTrackChanges()
  
  If ActiveDocument.TrackRevisions = True Then 
    MsgBox "On"
  Else
    MsgBox "Off"
  End If

End Sub

Description

Checking Docunent.TrackRevisions prperty

Sub...
  
  If ActiveDocument.TrackRevisions = True Then 

The 3rd line checks the Document.TrackRevisions property.

[Application.]ActiveDocument

  If ActiveDocument...

The Application.ActiveDocument property returns an active Document object.

obj-Word-Application-ActiveDocument

And the ActiveDocument property is a member of the Word.Global class, so we can omit the Application property.

obj-Word-ActiveDocument

Document.TrackRevisons

  If ActiveDocument.TrackReviions...

The Document.TrackRevisions property returns or sets whether the changes are tracked or not.

obj-Word-Document-TrackRevisions

Shows Message Box

Sub...
  
  If ActiveDocument.TrackRevisions = True Then 
    MsgBox "On"

The 4th line shows the message box: “On”.
If the Document.TrackRevisions property is True.

Sub...
  
  If ActiveDocument.TrackRevisions = True Then 
    MsgBox "On"
  Else
    MsgBox "Off"

The 6th line shows the message box: “Off”.
If the Document.TrackRevisions property is False.

Sub CheckTrackChanges()
  
  If ActiveDocument.TrackRevisions = True Then 
    MsgBox "On"
  Else
    MsgBox "Off"
  End If

End Sub

Properties

http://www.relief.jp/itnote/archives/word-vba-check-track-changes-mode.php

Apply To

  • Word 2013
  • Word 2010
  • Word 2007