Remarks

Each DocumentLibraryVersion object represents one saved version of the active document. When versioning is enabled, a new version is created on the server when the actions listed below occur; additional versions are not created each time the user saves changes to the open document.

Use the Modified, ModifiedBy, and Comments properties to return information about a saved version of a shared document.

Use the Open method to open a previous version, or the Restore method to restore a previous version in place of the current version. Use the Delete method to delete a version.

Example
The following example displays the properties of each saved version of the active document.

Visual Basic for Applications
 Dim dlvVersions As Office.DocumentLibraryVersions Dim dlvVersion As Office.DocumentLibraryVersion Dim strVersionInfo As String Set dlvVersions = ActiveDocument.DocumentLibraryVersions If dlvVersions.IsVersioningEnabled Then strVersionInfo = "This document has " & _ dlvVersions.Count & " versions: " & vbCrLf For Each dlvVersion In dlvVersions strVersionInfo = strVersionInfo & _ " - Version #: " & dlvVersion.Index & vbCrLf & _ " - Modified by: " & dlvVersion.ModifiedBy & vbCrLf & _ " - Modified on: " & dlvVersion.Modified & vbCrLf & _ " - Comments: " & dlvVersion.Comments & vbCrLf Next Else strVersionInfo = "Versioning not enabled for this document." End If MsgBox strVersionInfo, vbInformation + vbOKOnly, "Version Information" Set dlvVersion = Nothing Set dlvVersions = Nothing 

See also: