DocumentBase.AttachedTemplate Property

Definition

Gets or sets a Template that represents the template attached to the document.

public object AttachedTemplate { get; set; }

Property Value

Object

A Template that represents the template attached to the document.

Examples

The following code example displays a message that shows the name of the template that is attached to the document. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentAttachedTemplate()
{
    Word.Template attachedTemplate = (Word.Template)this.AttachedTemplate;
    MessageBox.Show(attachedTemplate.Name);
}
Private Sub DocumentAttachedTemplate()
    Dim attachedTemplate As Word.Template = CType(Me.AttachedTemplate, Word.Template)
    MessageBox.Show(attachedTemplate.Name)
End Sub

Remarks

To set this property, specify either the name of the template or an expression that returns a Template.

Applies to