申請。文件、財產 (Word)

會傳回代表所有開啟中文件的 Documents 集合。 唯讀。

語法

表情

expression 代表 Application 物件的變數。

註解

關於回傳集合中單一成員的資訊,請參見 從集合回傳物件

注意事項

在受保護檢視視窗中顯示的文件並非 文件集合的 成員。 相反地,請使用 ProtectedViewWindow 物件的 Document 屬性來存取顯示在 Protected View 視窗中的文件。

範例

This example creates a new document based on the Normal template and then displays the Save As dialog box.

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

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應