多种对象![]() ![]() ![]() |
该对象代表一个文档模板。Template 对象为 Templates 集合的一个成员。Templates 集合包含了所有可用的 Template 对象。
可用 Templates(index) 返回一个 Template 对象,其中 index 为模板名或索引号。下例当 Memo2.dot 模板在 Templates 集合中则保存该模板。
For Each aTemp In Templates
If LCase(aTemp.Name) = "memo2.dot" Then aTemp.Save
Next aTemp
索引号代表模板在 Templates 集合中的位置。下例打开 Templates 集合中的第一个模板。
Templates(1).OpenAsDocument
Add 方法在 Templates 集合中无效。可用下列方法之一在 Templates 集合中添加一个模板:
可用 NormalTemplate 属性返回一个基于 Normal 模板的模板对象。用 AttachedTemplate 属性返回一个附加于指定文档的模板。
可用 DefaultFilePath 属性返回或设置用户或工作组模板(即保存这些模板的文件夹)。下例在“工具”菜单中的“选项”对话框的“文件位置”选项卡中显示用户模板文件夹。
MsgBox Options.DefaultFilePath(wdUserTemplatesPath)