Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Adds a subtree as the last child under the context element node in the tree.
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 msoCustomXMLNodeElement, 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.
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.