Share via


XMLMapping.CustomXMLNode Property

Word Developer Reference

Returns a CustomXMLNode object that represents the custom XML node in the data store to which the content control in the document maps.

Syntax

expression.CustomXMLNode

expression   An expression that returns an XMLMapping object.

Example

The following example inserts a new content control and custom XML part into the active document, maps the content control to a node in the custom XML part, and then sets the value of the mapped XML node.

Visual Basic for Applications
  Dim objCC As ContentControl
Dim objPart As CustomXMLPart
Dim objNode As CustomXMLNode
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText) Set objPart = ActiveDocument.CustomXMLParts.Add("<books><book>" & _ "<author></author><title></title><genre></genre><price></price>" & _ "<pub_date></pub_date><abstract></abstract></book></books>")

Set objMap = objCC.XMLMapping objMap.SetMapping "/books/book/author", , objPart

Set objNode = objMap.CustomXMLNode objNode.Text = "Matt Hink"

objCC.Range.Text = objNode.Text

See Also