Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Stone Ridge, New York, USA
    Thanked 0 Times in 0 Posts

    ref fields in headers (Word 2000)

    I've created a Word form (locked) with headers that hold ref fields. The ref fields don't populate until the doc is put through to print. I want the ref fields to populate as the original field is tabbed out of. I've chosen "Calculate on exit" in the form field setup window which makes the ref fields operate correctly in regular form fields - but it's not working in the headers. Any suggestions?

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    New York, NY
    Thanked 29 Times in 27 Posts

    Re: ref fields in headers (Word 2000)

    Protected form or not, Ref fields in the header aren't going to update unless they are forced to by something like printing (or print preview) or switching windows.

    You can set up a macro to run on exit, which will update all the fields in the document's headers/footers. Here's one which was posted previously by Stuart Rance:

    <pre>Sub UpdateHeaderAndFooterFields()

    ' Updates all fields in headers and footers throughout the document

    Dim secSection As Section
    Dim hfHeader As HeaderFooter
    Dim hfFooter As HeaderFooter

    For Each secSection In ActiveDocument.Sections
    For Each hfHeader In secSection.Headers
    If Not hfHeader.LinkToPrevious Then hfHeader.Range.Fields.Update
    Next hfHeader
    For Each hfFooter In secSection.Footers
    If Not hfFooter.LinkToPrevious Then hfFooter.Range.Fields.Update
    Next hfFooter
    Next secSection
    End Sub</pre>

    It's also useful to keep in mind that StyleRef fields can be helpful when working in headers/footers - StyleRef fields will update in 'real time' without needing to print or run a macro.
    However it does turn out that when used in a protected document, the StyleRef fields don't update automatically either. You can update them using the same code as above, or else by using the simpler:

    <pre>Public Sub RefreshHeaderFooterStyleRefFields()
    End Sub


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts