Attached Templates

The AttachedTemplate property returns a Template object that represents the template attached to the specified document.
To set this property, specify either the name of the template or an expression that returns a Template object.

This attaches the template "" to the active document.

ActiveDocument.AttachedTemplate = "C:\Templates\" 

ActiveDocument.AttachedTemplate.Type = wdTemplateType.wdNormalTemplate 

Dim objTemplate As Template 
Set objTemplate = ActiveDocument.AttachedTemplate
Call MsgBox objTemplate.Path & Application.PathSeparator & objTemplate.Name

This example inserts the contents of the Spike (a built-in AutoText entry) at the beginning of document one.

Set myRange = Documents(1).Range(0, 0) 
Documents(1).AttachedTemplate.AutoTextEntries("Spike") _
    .Insert myRange

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext