Class Templates (Word VBA)

A collection of Template objects that represent all the templates that are currently available. This collection includes open templates, templates attached to open documents, and global templates loaded in the Templates and Add-ins dialog box. To use a Templates class variable it first needs to be instantiated, for example


Dim tmps as Templates
Set tmps = Templates

For Each

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


Dim tmp As Template
For Each tmp In Templates
	
Next tmp

Count

Returns a Long that represents the number of templates in the specified collection.


Dim lngCount As Long
lngCount = Templates.Count

Item

Returns an individual Template object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.


Dim tmp As Template
Set tmp = Templates(Index:=1)

LoadBuildingBlocks

Loads the building blocks for all templates into Microsoft Word.

Word normally loads building blocks when they are first needed, for example when a user displays a gallery by using the ribbon. This method forces Word to immediately load all building blocks.


Templates.LoadBuildingBlocks