XMLMapping.CustomXMLPart property (Word)

Returns a CustomXMLPart object that represents the custom XML part to which the content control in the document maps.

Syntax

expression. CustomXMLPart

expression An expression that returns an 'XMLMapping' object.

Example

The following example accesses the first content control in the active document and the custom XML part to which it is mapped, and then sets the text value of one of the XML nodes contained within the custom XML part.

Note

This example assumes that at least one content control in the active document is mapped to a custom XML part that contains the XML nodes specified in the XPath string.

Dim objCC As ContentControl 
Dim objPart As CustomXMLPart 
Dim objNode As CustomXMLNode 
 
Set objCC = ActiveDocument.ContentControls(1) 
Set objPart = objCC.XMLMapping.CustomXMLPart 
Set objNode = objPart.SelectSingleNode("/books/book/title") 
objNode.Text = "Mystery of the Empty Chair"

See also

XMLMapping Object

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.