會傳回代表所有開啟中文件的 Documents 集合。 唯讀。
語法
運算式。文件
expression 代表 Application 物件的變數。
註解
如需傳回集合單一成員的詳細資訊,請參閱 從集合傳回物件。
注意事項
顯示在 [受保護檢視] 視窗中的文件不是 [文件] 集合的成員。 請改用 ProtectedViewWindow 物件的 Document 屬性來存取 [受保護的檢視] 視窗中顯示的文件。
範例
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
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。