PDA

View Full Version : How update all Header&Footer at once?



akokin
03-11-2008, 07:07 AM
Hello.
Is there any way to update at once all the Header&Footer which is into different sections?
The code (show below) update only the Header (or Footer) into current page.

Sub updateHeadersFooters()
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Thank you.

akokin
03-11-2008, 07:12 AM
I only just try next the code and it worked:

Sub uHeadersFooters()
Dim oSection As Section
Dim HF As HeaderFooter
For Each oSection In ActiveDocument.Sections
For Each HF In oSection.Headers
HF.Range.Fields.Update
Next HF
Next oSection
end sub