Documents 属性

       

返回一个 Documents 集合,该集合代表所有打开的文档。只读。

有关返回集合中单个成员的内容,请参阅返回集合中的对象

示例

本示例根据 Normal 模板新建一篇文档,然后显示“另存为”对话框。

Documents.Add.Save

如果文档在上次保存后进行了修改,本示例将保存该文档。

Dim docLoop As Document

For Each docLoop In Documents
   If docLoop.Saved = False Then docLoop.Save
Next docLoop

本示例先将文档的左右边距设置为 0.5 英寸,然后打印所有打开的文档。

Dim docLoop As Document

For Each docLoop In Documents
    With docLoop
        .PageSetup.LeftMargin = InchesToPoints(0.5)
        .PageSetup.RightMargin = InchesToPoints(0.5)
        .PrintOut
    End With
Next docLoop

本示例以只读方式打开文档 Doc.doc。

Documents.Open FileName:="C:\Files\Doc.doc", ReadOnly:=True