Adds a subtree as the last child under the context element node in the tree.

Note
References to DTDs from custom XML parts are not supported. DTD references in custom XML parts will not resolve, and custom XML parts containing DTD references generate an exception when an attempt is made to save the file's content to a flat XML file.

Syntax

expression.AppendChildSubtree(XML)

expression An expression that returns a CustomXMLNode object.

Parameters

Name Required/Optional Data Type Description
XML Required String Represents the subtree to add.

Remarks

If the context node is any type other than msoXMLNodeElement, the append operation is not performed and an error message is displayed. If the CustomXMLNode is being validated against a schema and if the operation would result in an invalid tree structure, the append operation is not performed and an error message is displayed.

Example
The following example demonstrates appending a node to an existing node.

Visual Basic for Applications
Sub ShowCustomXmlParts() Dim cxp1 As CustomXMLPart Dim cxn As CustomXMLNode With ActiveDocument ' Add and populate a custom xml part set cxp1 = .CustomXMLParts.Add "<invoice />" ' Get nodes using XPath. Set cxn = cxp1.SelectSingleNode("//*[@quantity < 4]") ' Append a child subtree to the single node selected previously. cxn.AppendChildSubtree("<discounts><discount>0.10</discount></discounts>") End With End Sub

See also: