Microsoft KB Archive/922075

= How to update fields in a protected form in Word 2007 =

Article ID: 922075

Article Last Modified on 10/15/2007

-

APPLIES TO


 * Microsoft Office Word 2007

-





For a Microsoft Word 2002 and Microsoft Office Word 2003 version of this article, see 291474.



For a Microsoft Word 2000 version of this article, see 212356.



SUMMARY
Consider the following scenario. You open a document from an earlier version of Microsoft Word in Microsoft Office Word 2007. If the document is protected for filling in forms, some fields in this document may not be updated when you complete the form.

This article describes how these fields can be updated. Additionally, the article describes how to use a macro to automatically insert and update the result of one form field into another form field.



MORE INFORMATION
The methods that are described in this article use the tools in the Legacy Forms gallery. To access the Legacy forms gallery, click the Developer tab, click Legacy tools in the Control group, and then click the Legacy Forms tool that you want to use.

Note If you do not see the Developer tab, follow these steps:
 * 1) Click the Microsoft Office Button, and then click Word options.
 * 2) Click the Popular category, and then click to select the Show Developer tab in the Ribbon check box.

.

Method 1: Use the &quot;Calculate on exit&quot; option
In Word 2007, form fields include a Calculate on exit option. When this option is enabled, fields and form fields can be updated in a protected form document.

To enable the Calculate on exit option, follow these steps:
 * 1) Double-click a form field to display the Form Field Properties dialog box.
 * 2) Click to select the Calculate on exit check box, and then click OK.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

212244 How to update Text form fields automatically by using the &quot;Calculate on exit&quot; option in Word 2000 or Word 2002

Method 2: Update the reference fields in a printed document
You may want to use a reference field to repeat a form field entry elsewhere in a document. These reference fields must be updated to print the form field entry that the reference fields are repeating. An update includes all fields, such as &quot;date&quot; and &quot;time.&quot;

To update the reference fields, follow these steps:
 * 1) Click the Microsoft Office Button, and then click Word options.
 * 2) Click Display, and then click to select the Update fields before printing check box under Printing options.

Note When you select this option, fields may not be updated on the screen. However, Word 2007 updates the fields correctly when you print the document.

Note To use a reference field to repeat a form field entry, follow these steps:
 * 1) Position the cursor where you want the data to be repeated.
 * 2) On the Insert tab, click Cross-reference in the Links group.
 * 3) Click Bookmark in the Reference type list, and then click Bookmark text in the Insert reference to list.
 * 4) Click to clear the Insert as hyperlink check box.
 * 5) In the For which bookmark box, select the form field bookmark name that represents the form field into which you are entering the data.
 * 6) Click Insert, and then click Close.

Method 3: Use a macro
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

You may require all fields to be updated on the screen as you complete the form. This includes fields that are not updated by using the Calculate on exit option that is described in Method 1. In this case, use the following macro as the &quot;On exit&quot; macro for the form field or fields.

Note When you run the following macro, all fields in the whole document are updated. This includes linked objects, such as a linked Microsoft Excel spreadsheet. Sub UpdateAllFields

Dim aStory As Range Dim aField As Field

For Each aStory In ActiveDocument.StoryRanges For Each aField In aStory.Fields aField.Update Next aField Next aStory

End Sub Note Because this &quot;On exit&quot; macro may cause a small delay on some computers, you may want to enable the Update Fields on printing option if the document is to be a printed form. You may also want to enable the Calculate on exit option, as described in Method 1.

Additional query words: OfficeKBHowTo forms formfield ref unprotect vba inf

Keywords: kbhowto kbinfo kbcodesnippet kbprogramming kbautomation kbforms kbfield kbexpertiseinter KB922075

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.