
XMLMapping.SetMapping mapping & "2",, cxp Content.Paragraphs(2).Range.ContentControls XMLMapping.SetMapping mapping & "1",, cxp Content.Paragraphs(1).Range.ContentControls Mapping = "/" & myprefix & ":root/" & myprefix & ":property" ' ' (The web address does not actually have to exist)Ĭonst UniqueURI As String = "YourUniqueID"

' Some people use a domain name or web address that they ' a unique name by you or your organisation ' This should be set to a string that should ideally be Notice that you can go over 255 characters *and* have multiple lines. With an empty document open, run the first sub. Some sample VBA for use with an empty document that shows how to create a Custom XML Part and some mapped Content Controls, and what happens when you update the data in it. You need a Custom XML Part with an XML element for each property, and you need a Plain Text Content Control that is mapped to each part.

modifying the data in the part results in an immediate update to Content Controls linked to it, although if you have any Mac Word users not all of the functionality. They have to be updated using select then F9, same as DOCPROPERTY fields.Ĭustom XML Parts + mapped content controls have some advantages, e.g. To insert the value in the document, use a field code (ctrl-F9 for the special field code braces ) To create or set a DOcument Variable, useĪctiveDocument.Variables("thevariablename") = "the text value" That would allow the user to change the values. The main difference from Document Properties is that there is no built-in user interface

Document Variables are simpler (simpler than Custom Document Properties IMO). You have two options - use Document Variables instead, or use mapped content controls instead.
