ContentControl.XMLMapping Property

Word Developer Reference

Returns an XMLMapping object that represents the mapping of a content control to XML data in the data store of a document. Read-only.



expression An expression that returns a ContentControl object.


The following example sets the built-in Author document property and adds a new content control to the active document, and then sets the mapping for the control to the value of the built-in document property.

Visual Basic for Applications
  Dim objCC As ContentControl
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objCC = ActiveDocument.ContentControls.Add _
    (wdContentControlText, ActiveDocument.Paragraphs(1).Range)

Set objMap = objCC.XMLMapping
blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:creator[1]")

If blnMap = False Then
    MsgBox "Unable to map the content control."
End If

See Also