Document.TransformDocument Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.

expression .TransformDocument(Path, DataOnly)

expression Required. A variable that represents a Document object.

Parameters

Name

Required/Optional

Data Type

Description

Path

Required

String

The path for the XSLT to use.

DataOnly

Optional

Boolean

True applies the transformation only to the data in the document, excluding Microsoft Word XML. False applies the transform to the entire document, including Word XML. Default value is True.

The following example transforms the active document using the specified XSLT file.

ActiveDocument.TransformDocument _ 
 ("c:\schemas\simplesample.xslt")
Show: