CustomXMLNode.RemoveChild method (Office)
Removes the specified child node from the tree.
Syntax
expression.RemoveChild(Child)
expression An expression that returns a CustomXMLNode object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Child | Required | CustomXMLNode | Represents the child node of the context node. |
Remarks
If the node specified in the Child parameter is not a child of the context node, or if the action would result in an invalid tree, the removal is not performed and an error message is displayed.
Example
The following example selects a custom part and then a node in that part. The code then removes a child of that node.
Dim cxp1 As CustomXMLPart
Dim cxn As CustomXMLNode
With ActiveDocument
' Return the first part with the given root namespace.
Set cxp1 = .CustomXMLParts("urn:invoice:namespace")
' Get node using XPath expression.
Set cxn = cxp1.SelectSingleNode("//*[@supplierID = 1]")
' Remove a child node.
cxn.RemoveChild(cxn.SelectSingleNode("//discount"))
End With
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for