UpdateStyles Method

Applies To

Document object.

Description

Copies all styles from the attached template into the document, overwriting any existing styles in the document that have the same name.

Syntax

expression.UpdateStyles

expression Required. An expression that returns a Document object.

See Also

CopyStylesFromTemplate method, OpenAsDocument method, UpdateStylesOnOpen property.

Example

This example copies the styles from the attached template into each open document, and then it closes each document.

For Each aDoc In Documents
    aDoc.UpdateStyles
    aDoc.Close SaveChanges:=wdSaveChanges
Next aDoc
This example changes the formatting of the Heading 1 style in the template attached to the active document. The UpdateStyles method updates the styles in the active document, including the Heading 1 style.

Set aDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
With aDoc.Styles(wdStyleHeading1).Font
    .Name = "Arial"
    .Bold = False
End With
aDoc.Close SaveChanges:=wdSaveChanges
ActiveDocument.UpdateStyles