返回 模板 集合,该集合代表所有可用的模板 共用模板和附加到打开文档。
语法
expression. Templates
表达式是必需的。 一个代表“全局”对象的变量。
备注
有关返回集合的单个成员的信息,请参阅 从集合中返回对象。
示例
本示例显示 模板 集合中的每个模板的名称。
Count = 1
For Each aTemplate In Templates
MsgBox aTemplate.Name & " is template number " & Count
Count = Count + 1
Next aTemplate
本示例中,如果模板 1 是一个共用模板,则其路径存储在 thePath 中。 ChDir 语句用于将具有存储在 thePath 中的路径的文件夹设为当前文件夹。 在进行此更改后,将显示 打开对话框。
If Templates(1).Type = wdGlobalTemplate Then
thePath = Templates(1).Path
If thePath <> "" Then ChDir thePath
Dialogs(wdDialogFileOpen).Show
End If
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。