Revisions Collection Object

Microsoft Word Visual Basic

Multiple objectsRevisions
Revision
Multiple objects

A collection of Revision objects that represent the changes marked with revision marks in a range or document.

Using the Revisions Collection

Use the Revisions property to return the Revisions collection. The following example displays the number of revisions in the main text story.

MsgBox ActiveDocument.Revisions.Count
		

The following example accepts all the revisions in the selection.

For Each myRev In Selection.Range.Revisions
    myRev.Accept
Next myRev
		

The following example accepts all the revisions in the first paragraph in the selection.

Set myRange = Selection.Paragraphs(1).Range
myRange.Revisions.AcceptAll
		

The Add method isn't available for the Revisions collection. Revision objects are added when change tracking is enabled. Set the TrackRevisions property to True to track revisions made to the document text. The following example enables revision tracking in the active document and then inserts "The " before the selection.

ActiveDocument.TrackRevisions = True
Selection.InsertBefore "The "
		

Use Revisions(index), where index is the index number, to return a single Revision object. The index number represents the position of the revision in the range or document. The following example displays the author name for the first revision in the first section.

MsgBox ActiveDocument.Sections(1).Range.Revisions(1).Author
		

Remarks

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.