Combining Field Codes and Bookmarks
You can combine field codes with bookmarks to automatically enter text into a document. Heres how to create a solution that prompts people for their name and then inserts it into two places in a document.
- Start with a new document and choose Insert > Field
- From the Categories list choose Mail Merge
- From the Field Names list choose ASK
- Type Your Name in the Prompt box
- In the Bookmark Name box type YourName.
- Select the Default Response to Prompt checkbox and type Type your name in here
- Click OK
You should now see a dialog on the screen prompting you to type your name. Click OK to accept this ‑ do not type anything into the box at this stage.
![]() Use the REF field to enter data that the user types in response to the ASK question. (Click for larger image). |
The bookmark reference "YourName" is the key to entering your name into the document.
- Click on the place in the document where you first want your name to appear, and choose Insert > Field
- From the Categories list choose Links and References
- Click the REF field in the Field Names list
- Next click the Field Codes button and after the word REF type YourName
- Click Hide Codes and then from the Format dropdown list choose Title Case
- Click OK
You should now see the text "Type your name in here" in the position that you placed the REF field code.
Repeat this process and create a REF field at each position in the document where your name should appear. Create each REF field exactly the same way as the previous one using the YourName bookmark, but you can choose different formatting if you like. When you're done, save the document as a regular document or a template as desired.
![]() When you update field codes in the document, the ASK field prompts you for information. (Click for larger image). |
To see how this feature works, open the document and:
- Choose Edit > Select All or press Ctrl + A to select the entire document
- Press F9 to update the fields in the document. This triggers the ASK field which displays the dialog on the screen prompting you to enter your name.
- Enter your name and click OK
In each place where you placed a REF field you should now see your name appear.
If you need multiple pieces of information entered into a document in lots of different places, create ASK fields for each of them and place a REF field in each position you need to insert the data into the document.
The only proviso is to ensure that each ASK field has a different bookmark name and that the REF field refers to the bookmark name for the particular data you want inserted at that point in the document.
These examples demonstrate a few ways that Word field codes can help you automate document production and help ensure that data entered into your documents is consistent throughout.Helen Bradley is a respected international journalist writing regularly for small business and computer publications in the USA, Canada, South Africa, UK and Australia. You can learn more about her at her Web site, HelenBradley.com
Do you have a comment or question about this article or other small business topics in general? Speak out in the SmallBusinessComputing.com Forums. Join the discussion today! |