I want to create a field in a template (dotx) that, when starting a new document from that template, would prompt for information. The field is something that repeats over and over in the document. I want to be able to enter it once and that it would update itself across the document.
3 Answers
The simplest way for a single item of data is as follows.
First, insert a FILLIN field in the template
(In Windows Word, use ctrl-F9 to insert a pair of the special field code braces { } then type
FILLIN "my prompt text"
between the { }
so you see
{ FILLIN "my prompt text" }
If you select the field and press F9, you should see a dialog box where you can type the value you need. When you have entered the value, Word should display the value at the location where the FILLIN field is (press Alt-F9 to toggle between "field codes" and "field results" view.
To make Word show the same thing in several places in your document, Select your FILLIN field and press ctrl-F9 again to wrap it in another pair of { } Then, after the initial "{", type
SET myfield
So that the whole thing looks like
{ SET myfield { FILLIN "my prompt text" } }
Then, at each point where you need the value, insert another field like this:
{ myfield }
which is shorthand for
{ REF myfield }
When you create a new document based on the template, Word should execute the FILLIN, then update all the { myfield } fields. But if the user needs to change the value later, they will need to select the entire document (e.g.ctrl-A) and press F9 to see the prompt again. In that case, I'm not sure the fields will be updated everywhere.
There is another field type called ASK which, in effect, combines a SET and a FILLIN, but it is not automatically executed when you create a new document based on the template so is not such a good choice for this task.
There is a bit more to the FILLIN field than that, but I leave you to look that up.
I was able to just use simple FILLIN fields for my application, but I was having a hard time getting my prompt windows to appear when opening the document. I didn't realize that I had to save the word document as a template (.dotx) before it would work. After I did that it worked great!
I just tried to get the FILLIN merge field to work per the instructions and couldn't get it to work. A less complex way is to use the STYLEREF merge field. To do this, create a generic field name for the first instance of the data (e.g. "organization" or "date") and create a unique style for it (for the purposes of these instructions, I'll call it "Style1"). At each place in the document where you want the data to repeat, select ctl+F9 and insert STYLEREF "Style1" between the brackets (it will look like this: { STYLEREF "Style1" }. So long as you don't disassociate the style from the first entry. Note, don't use the style you've used for anything else but for that merge field. Word populates this merge field from the last know entry for the style.
- 760