Hello all, I'm trying to automate some fields in the header and footer by
making a VBA userform and having it plug into document. While I can use
document vars to plug in values in the regular bodytext and use
activedocument.fields.update to show the new values, this won't work for
header and footer fields. I would need to view the header and footer and
refresh manually with F9. Any suggestions? Thanks
Doug Robbins - Word MVP - 17 Jan 2006 05:14 GMT
Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
With .Sections(i)
.Headers(wdHeaderFooterFirstPage).Range.Fields.Update
.Headers(wdHeaderFooterPrimary).Range.Fields.Update
.Footers(wdHeaderFooterFirstPage).Range.Fields.Update
.Footers(wdHeaderFooterPrimary).Range.Fields.Update
End With
Next i
End With
or maybe
With ActiveDocument
.PrintPreview
.ClosePrintPreview
End With

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hello all, I'm trying to automate some fields in the header and footer by
> making a VBA userform and having it plug into document. While I can use
> document vars to plug in values in the regular bodytext and use
> activedocument.fields.update to show the new values, this won't work for
> header and footer fields. I would need to view the header and footer and
> refresh manually with F9. Any suggestions? Thanks
Charles Kenyon - 17 Jan 2006 06:39 GMT
Note also that a docvariable field in a header or footer will crash Word 97.

Signature
Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
> Hello all, I'm trying to automate some fields in the header and footer by
> making a VBA userform and having it plug into document. While I can use
> document vars to plug in values in the regular bodytext and use
> activedocument.fields.update to show the new values, this won't work for
> header and footer fields. I would need to view the header and footer and
> refresh manually with F9. Any suggestions? Thanks