field updates

H

h. s. stone

Thanks but that only worded for the fields in teh main
document not in the header
 
M

macropod

Hi H,

Not sure which part of the original thread you're replying
to, and this gives two possible answers:

If the problem was that the Ctrl-A then F9 approach didn't
work, go into Tools|Options|Print and make sure
the 'Update Fields' option is checked. That may be
sufficient to get the fields to update by doing a Print
Preview. If not, clicking the print button, then
immediately double-clicking the printer icon that appears
on the status bar at the bottom of the Word window (to
cancel the printing) should work.

If the problem was that the macro didn't update fields in
headers/footers, try the following-

Sub RefreshFields()
Dim oSection As Section
Dim shp as Shape
Dim oHeadFoot As HeaderFooter
ActiveDocument.Fields.Update
For Each oSection In ActiveDocument.Sections
For Each oHeadFoot In oSection.Footers
If Not oHeadFoot.LinkToPrevious Then
oHeadFoot.Range.Fields.Update
End If
Next
For Each oHeadFoot In oSection.Headers
If Not oHeadFoot.LinkToPrevious Then
oHeadFoot.Range.Fields.Update
End If
Next
Next 'oSection
For Each shp In doc.Shapes
With shp.TextFrame
If .HasText Then
.TextRange.Fields.Update
End If
End With
Next
End Sub


Cheers
PS: Remove NO.SPAM from the above before replying.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top