Document 对象 (Word)Document object (Word)

代表一个文档。Represents a document. Document对象是**Documents** 集合的一个成员。The Document object is a member of the Documents collection. Documents 集合包含 Word 中当前打开的所有 Document 对象。The Documents collection contains all the Document objects that are currently open in Word.

注释Remarks

使用文档(索引), 其中_索引_是文档名称或索引号, 返回单个文档对象。Use Documents (index), where index is the document name or index number, to return a single Document object. 下面的示例在不保存更改的情况下关闭名为 "报表 .doc" 的文档。The following example closes the document named Report.doc without saving changes.

Documents("Report.doc").Close SaveChanges:=wdDoNotSaveChanges

索引编号代表文档在 Documents 集合中的位置。The index number represents the position of the document in the Documents collection. 以下示例激活 Documents 集合中的第一篇文档。The following example activates the first document in the Documents collection.

Documents(1).Activate

您可以使用**ActiveDocument** 属性来引用具有焦点的文档。You can use the ActiveDocument property to refer to the document with the focus. 下面的示例使用**activate** 方法激活名为 document 1 的文档。The following example uses the Activate method to activate the document named Document 1. 另外,以下示例还会将页面方向设置为横向模式,然后再打印文档。The example also sets the page orientation to landscape mode and then prints the document.

Documents("Document1").Activate 
ActiveDocument.PageSetup.Orientation = wdOrientLandscape 
ActiveDocument.PrintOut

事件Events

方法Methods

属性Properties

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.