DocumentBase.Versions 屬性

取得 Versions 集合,表示文件的所有版本。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property Versions As Versions
    Get
public Versions Versions { get; }

屬性值

型別:Microsoft.Office.Interop.Word.Versions
Versions 集合,表示文件的所有版本。

範例

下列程式碼範例會使用 Versions 屬性儲存新版文件,然後顯示訊息說明文件的所有版本。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間