Share via


Document.Versions Property (2007 System)

Gets a Versions collection that represents all the versions of the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Versions As Versions
'Usage
Dim instance As Document 
Dim value As Versions 

value = instance.Versions
[BrowsableAttribute(false)]
public Versions Versions { get; }
[BrowsableAttribute(false)]
public:
property Versions^ Versions {
    Versions^ get ();
}
public function get Versions () : Versions

Property Value

Type: Versions
A Versions collection that represents all the versions of the document.

Examples

The following code example uses the Versions property to save a new version of the document and then displays information about all versions of the document.

This example is for a document-level customization.

Private Sub DocumentVersions()
    Dim comment As Object = "My first save." 
    Me.Versions.Save(comment)

    Dim version As Word.Version
    For Each version In Me.Versions
        MessageBox.Show("Version " & version.Index.ToString() & " saved by " _
            & version.SavedBy & " on " & version.Date)
    Next version
End Sub
private void DocumentVersions()
{
    object comment = "My first save.";
    this.Versions.Save(ref comment);

    foreach (Word.Version version in this.Versions)
    {
        MessageBox.Show("Version " + version.Index.ToString() +
            " saved by " + version.SavedBy + " on " +
            version.Date);
    }
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace