bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Fields > Updating Fields in Locked Forms

Updating Fields in Locked Forms

Summary: If you create a form in Word and then lock it, you may notice that regular fields don’t get updated in the locked document as you might expect. If you want to update the fields, you must first unlock the document. This tip provides a quick macro you can use that will unlock, update, and relock the form—quite a timesaver! (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)

If you are creating a form in Word, it is possible to use two types of fields in the form: regular fields and form fields. Form fields, and how they are updated, are covered in other issues of WordTips. If you are creating a form that utilizes other types of fields that must be periodically updated, it can be frustrating to do so. Why? Because Word doesn't always update regular fields as you are filling in a locked form.

Unfortunately, the only way to update such fields is either to print the document (which normally forces all fields to be updated) or to force updates through the use of a macro. If the latter is the desired course, the macro must accomplish the following:

  1. Unlock the document.
  2. Update the fields.
  3. Relock the document.

This is a relatively easy task to do using VBA. You can use a macro such as the following:

Sub UpdateFields()
    Dim OneStory as Range
    Dim OneField as Field

    ActiveDocument.Unprotect Password:="YourPassword"
    For Each OneStory In ActiveDocument.StoryRanges
        For Each OneField in Stories.Fields
            OneField.Update
        Next OneField
    Next OneStory
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
      NoReset:=True, Password:="YourPassword"
End Sub

Tip #1543 applies to Microsoft Word versions: 97 | 2000 | 2002 | 2003


More Power! Expand your skills and make Word really sing! It's all possible with macros. The best resource anywhere for macros is WordTips: The Macros. Check it out today!

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Vital News Home

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)