CustomXMLNodes Object (Office)

Office 2013 and later

Contribute to this content

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

Contains a collection of CustomXMLNodes objects representing the XML nodes in a document.

The Attributes and the ChildNodes properties return collections of nodes of this type.

The following example selects one or more matching the XPath expression.

Sub CustomXmlNodes() 
    Dim cxp1 As CustomXMLPart 
    Dim cxns As CustomXMLNodes 
    With ActiveDocument 
        ' Returns the first custom xml part with the given root namespace. 
        Set cxp1 = .CustomXMLParts("urn:invoice:namespace")  
        ' Get custom xml nodes using XPath.                              
        Set cxns = cxp1.SelectNodes("//*[@unitPrice > 20]")  
    End With 
End Sub