11

I am trying to create a document in which the user will be given the opportunity to enter some text and I would like to use that in the rest of the places in that same document. The text entered by the user will be used in many places in the same document and changing the name at any time should be reflected in rest of the document.

For example, in the very first page of the document, I would like to get the user's name and age and use it in other places as shown in the following screenshot.

enter image description here

I tried to use plain text content control to get the name and age. But I could not find a way to insert those as fields in my text.

Any ideas on how I can achieve this? I am even ready to do a mailmerge, but I do not want the data to be from any place other than this document. The screen shot was tried in Office 2013, but it would be great if it works right from 2007 onwards. I do not want to do it with macros.

6

I think you'll have to use the Word Template and DocVariables. This also means some VBa but this tutorial covers it

http://www.gmayor.com/BookmarkandVariableEditor.htm

However, as an example of making it read content from else where, this may get you going... This isn't perfect but, it may be a good start!

In word, add the developer toolbar to the ribbon.

From the developer toolbar, drop in 2 text boxes from the controls tab.

Click on the Insert toolbar.

Now, click on the first textbox (the one where text is to be copied too). Make sure you click on the 3 little dots on the left side so the entire textbox is selected. When you have selected it, the Bookmark (under Links) should become enabled. Click on it and give it an appropriate name.

Click on the second textbox, and do the same but this time, click on Cross Reference. In the drop down box, select bookmarks and then find the book mark in question.

This is set up, but, you have to manually update the field. So, type some text into the first textbox, then right click on the second and select Update Fields. As I said, not perfect, but hopefully a start!

This article explains it can be done with a Template and Macros. http://word.mvps.org/FAQs/Userforms/CreateAUserform.htm

  • The key to being able to create the bookmark was to click on the three dots. – shipr Jun 4 '16 at 21:06
12

For Windows Word 2007 and later, you can use some of the Content Controls that Word inserts from Insert->Quick Parts->Document Property... For example, if you insert the "Author" Document Property, Word inserts a content control that is connected to the built-in property. So when you change the value in one copy of the content control, the property value updates, then all other Author content controls are updated automatically. This is different from the pre-Word 2007 approach where you had to insert an { AUTHOR } field, then seleect it and update it.

Using the Developer tab, you can select the resulting content control and give it a new Title such as "Age". Then you can copy/paste copies of the control with that title. It's also usually helpful to make the controls non-deletable.

If you don't want to use the traditional built-in properties such as Author etc., there is a set of five "properties" called Cover Page Properties that you can use instead. These are also available from the Document Property... menu, but the values are stored in a different place, i.e. in a Custom XML part created by Word. I think these are Company Address, Company Email, COmpany Fax, Company Phone, and Publish Date. Again, you can modify the Title using the Developer tab.

Beyond that, you have to use VBA or some such. If you're using Content controls, you have to create your own Custom XML part to store the values, and connect the controls to that store. You'll find a good summary of various options for "repeating data" here

FWIW, if you need to use forms in Word, the most "compatible" type of form field is what are called "Legacy Form fields" in Windows Word, because these are the only type that also work in Mac Word. But if you only need stuff to work in Windows Word 2007 and later, content controls have some advantages.

  • Is there a way to add additional custom "cover page property" fields to a template so that they show up in the Document Property dropdown list with a custom name? E.g., "Job Number"? Perhaps by directly editing the XML of the template? – Rick supports Monica Dec 22 '15 at 17:17
  • @Rick you can't add "cover page" properties because Word only recognises the predefined ones. You can add properties that will appear in the list, but you either need SharePoint or you need to be able to replicate what SharePoint creates. If you have SharePoint and are able to create a Document Library with custom columns, then a Word document opened from the library will have additional.properties. once the document has been created, it can be used standalone, but the content controls do not work in quite the same way (primarily, no server validation) – user181946 Dec 22 '15 at 17:28
  • Thanks. I wonder if it would be possible to directly edit the XML file (since the .dotx file is little more than a ZIP document) and add the custom properties that way. I would only need to do it the one time. Thanks for your help. – Rick supports Monica Dec 22 '15 at 17:51
  • 1
    You could, but the XML that Word uses is quite complicated (there is a custom XML part that defines a schema for the various "metaproperties" in the document. Nor is that XML described in detail anywhere I know, so you need a starting point that someone has created on SharePoint. BTW, this stuff is so obviously designed for use with SharePoint that it's unlikely you'll ever get any support while using it independently. Further, it would probably cause difficulties if anyone stored documents created this way in their own SharePoinnt system. – user181946 Dec 22 '15 at 18:09
  • Understood. It's probably not beyond my ability, but it's also probably not worth the time to figure out. I'll explore other avenues to solve my problems. – Rick supports Monica Dec 22 '15 at 20:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.