Word) (Application.Templates 屬性

會傳回代表所有可用範本的 Templates 集合 — 共用範本以及附加至開啟之文件。

語法

expressionTemplates

表達 會傳回 Application 物件的運算式。

註解

如需傳回集合中單一成員的資訊,請參閱 從集合傳回物件

範例

此範例會顯示 Templates 集合中之每個範本的名稱。

Count = 1 
For Each aTemplate In Templates 
 MsgBox aTemplate.Name & " is template number " & Count 
 Count = Count + 1 
Next aTemplate

在此範例中,如果第一個範本是全域範本,則其路徑會儲存在 中 thePathChDir 陳述式用於將儲存在 thePath目前資料夾的路徑的資料夾。 建立此變更時,會顯示 [ 開啟] 對話方塊。

If Templates(1).Type = wdGlobalTemplate Then 
 thePath = Templates(1).Path 
 If thePath <> "" Then ChDir thePath 
 Dialogs(wdDialogFileOpen).Show 
End If

另請參閱

Application 物件

支援和意見反應

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