Class Template (Word VBA)

The class Template represents a document template. The Template object is a member of the Templates collection. The Templates collection includes all the available Template objects.

The classes Application and Document. give access to class Template

To use a Template class variable it first needs to be instantiated, for example

Dim tmp as Template
Set tmp = CustomizationContext

The following procedures can be used to set variables of type Template: Application.CustomizationContext, Application.MacroContainer, Application.NormalTemplate, Document.AttachedTemplate and Templates.Item.

For Each

Here is an example of processing the Template items in a collection.

Dim tmp As Template
For Each tmp In Templates
	
Next tmp

Methods

OpenAsDocument - Opens the specified template as a document and returns a Document object.

Save - Saves the specified template.

Properties

Name (Default member) - Returns the name of the specified object.

AutoSaveOn

BuildingBlockEntries returns a BuildingBlockEntries collection that represents the collection of building block entries in a template.

BuildingBlockTypes returns a BuildingBlockTypes collection that represents the collection of building block types that are contained in a template.

BuiltInDocumentProperties returns a DocumentProperties collection that represents all the built-in document properties for the specified document.

CustomDocumentProperties returns a DocumentProperties collection that represents all the custom document properties for the specified document.

FarEastLineBreakLanguage returns or sets the East Asian language to use when breaking lines of text in the specified document or template.

FarEastLineBreakLevel returns or sets the line break control level for the specified document.

FullName specifies the name of a template, including the drive or Web path.

JustificationMode returns or sets the character spacing adjustment for the specified template.

KerningByAlgorithm true if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document.

LanguageID returns or sets a WdLanguageID constant that represents the language for the specified range.

LanguageIDFarEast returns or sets an East Asian language for the specified object.

ListTemplates returns a ListTemplates collection that represents all the list formats for the specified template.

NoLineBreakAfter returns or sets the kinsoku characters after which Microsoft Word will not break a line.

NoLineBreakBefore returns or sets the kinsoku characters before which Microsoft Word will not break a line.

NoProofing true if the spelling and grammar checker ignores documents based on this template.

Path returns the path to the specified document template.

Saved true if the specified template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed.

Type returns the template type.

VBProject returns the VBProject object for the specified template.

BuildingBlockEntries - Represents a collection of all BuildingBlock objects in a template.

BuildingBlockTypes - Represents a collection of BuildingBlockType objects.

Document - Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.

ListTemplates - A collection of ListTemplate objects in a document, list gallery, or template.