Versions 集合对象

         
Documents (Document)
Versions (Version)

Version 对象组成的集合,该对象代表文档的所有版本。对应于“文件”菜单“版本”对话框中所列的项目。

使用 Versions 集合

可用 Versions 属性返回一个 Versions 集合。下列示例关闭自动创建新文档版本的选项。

ActiveDocument.Versions.AutoVersion = wdAutoVersionOff

可使用 Save 方法在 Versions 集合中添加一个新项目。下列示例在具有指定备注的活动文档中添加一个版本。

ActiveDocument.Versions.Save _
    Comment:="incorporated Judy's revisions"

可用 Versions(index) 返回一个 Version 对象,其中 index 为索引序号。索引序号代表 Versions 集合中版本的位置。Versions 集合中第一个版本的索引序号为 1,下列示例显示了活动文档中第一个版本的备注、作者及日期。

If ActiveDocument.Versions.Count >= 1 Then
    With ActiveDocument.Versions(1)
        MsgBox "Comment = " & .Comment & vbCr & "Author = " & _
            .SavedBy & vbCr & "Date = " & .Date
    End With
End If