WD: How to Update Fields in a Protected FormLast reviewed: February 27, 1998Article ID: Q115607 |
The information in this article applies to:
SUMMARYFields in a document protected for forms may not be updated when you fill out the form. This article describes four methods you can use to update regular fields or automatically insert and update the result of one form field into another area of a form.
MORE INFORMATIONWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Method 1: Use the "Calculate On Exit" Option Microsoft Word 97 for WindowsIn Microsoft Word 97 for Windows, form fields include a "Calculate on exit" option. When you enable this option, fields and form fields can be updated in a protected form document. Fields not updated by this switch include:
TOC PAGE INDEX PAGEREFFor additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q157463 TITLE : Using Calculate on Exit in a Forms Document Method 2: Use a MacroThe following macro can be used as an on-exit macro for the first form field called TEXT1 so that the information entered into this field will automatically appear in the form field called TEXT2. Alternatively, the macro can be used as an on-entry macro for the second form field called TEXT2. When you tab to this second field, the result of the first form field is placed automatically as the field result of this second field. Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.
Word 97 ------- Sub Main() ActiveDocument.FormFields("text2").Result = ActiveDocument.FormFields("Text1").Result End Sub -or- Sub Main() With ActiveDocument .FormFields("Text2").Result = .FormFields("Text1").Result End With End Sub Word 6.x and 7.x ---------------- Sub Main SetFormResult "text2", GetFormResult$ ("text1") End SubIn the examples above, "text1" and "text2" are bookmarks. The text1 bookmark represents the field that contains the information you want to automatically appear in the field represented by the text2 bookmark. For each field that receives the information automatically, clear the Fill- In Enabled check box in the Text Form Field Options dialog box. This minimizes the chance of accidentally modifying the field result.
Method 3: Reference a Form Field Entry Elsewhere in a DocumentThere may be times that you may want to reference a form field entry elsewhere in a document. To repeat a form field entry using a reference field, follow these steps:
Method 4: Place the REF Field in an Unprotected Section of the DocumentIf you choose this option, the macro will update the fields in the unprotected section or you can create a separate exit macro to go to that specific field and update it. To place REF fields in unprotected sections of your document:
ARTICLE-ID: Q114237 TITLE : REF Field Creates Duplicate Drop-Down List in Protected Form ARTICLE-ID: Q117209 TITLE : How to Use AutoText As a Result of a Form Field Entry REFERENCES"Microsoft Word User's Guide," version 6.0, pages 305-326, 731- 755
|
Additional query words: forms formfield ref unprotect wordbasic vba
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |