Repeating Data - Word 2007



I'm creating a template, and would like the title and document # to
automatically repeat in the document after they've been entered on the cover

I have done this successfully using the method described at (section 7, by mapping these two
fields to built-in Document Property content controls). It works well.

However, I'm wondering if there's a way to see what properties the two
fields are mapped to? I do remember for this document, but if I'm using the
same technique for other templates, it would be helpful to be able to see
which of the document's built-in properties I'm mapped to.

Anyone know if this is possible?

(I'm really hoping that in Word 2010 they will make it easier to re-use data
entered into content controls. It's such a potentially useful feature, and
it's a shame that it can only really be accessed in 2007 by mapping to a
limited number of document properties, or by using complicated code. </rant>)



Greg Maxey


Yes. Well yes in a rather indirect way.

If you entered each of the 15 builtin properties in a text document
and fille them in like "This is the Author" "This is a commnet" etc.
and then ran this code:

Sub ShowCustomXMLPartsText()
With ActiveDocument.Range
.InsertAfter "CustomXML Part 1 XML: " & ActiveDocument.CustomXMLParts
(1).XML & vbCr & vbCr
.InsertAfter "CustomXML Part 2 XML: " & ActiveDocument.CustomXMLParts
(2).XML & vbCr & vbCr
.InsertAfter "CustomXML Part 2 XML: " & ActiveDocument.CustomXMLParts
End With
End Sub

You would get a printout something like this. This will tell you that
the "Author" built in property maps to the "creator" node in the
coreProperties CustomXML Part.

CustomXML Part 1 XML: <cp:coreProperties xmlns:dc="
elements/1.1/" xmlns:cp="
2006/metadata/core-properties"><dc:creator>This is the author</
dc:creator><cp:keywords>This is the keyword</
cp:keywords><dc:description>This is the comment</
dc:description><dc:subject>This is the subject</
dc:subject><dc:title>This is the title</dc:title><cp:category>This is
the category</cp:category><cp:contentStatus>This is the status</

CustomXML Part 2 XML: <Properties xmlns="http://
properties"><Company>This is the company</Company><Manager>This is the

CustomXML Part 2 XML: <CoverPageProperties xmlns="http://"><PublishDate>This is
the publish date</PublishDate><Abstract>This is the abstract</
Abstract><CompanyAddress>This is the Co. address</
CompanyAddress><CompanyPhone>This is the Co. Phone</
CompanyPhone><CompanyFax>This is the Co. Fax</
CompanyFax><CompanyEmail>This is the Co. E-mail</CompanyEmail></

Now if you select any of the controls and run this:

Sub Querry()
MsgBox Selection.ContentControls(1).XMLMapping.CustomXMLNode.BaseName
End Sub

It will tell which node the control is mapped to.

Let's leave the ranting to dear Peter. He does it so well. The
complicated code for mapping CCs has already been worke out for you.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question