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

Concepts

CustomXMLNode Object Members

CustomXMLNode Object