UpdateAll code Graham Mayor

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Code from Graham's website solved my problem, but created a new one. It seems that navigation through the document has become exceedingly slow, e.g., web navigation from table of contents. This is apparently due to the macro. Any suggestions or ideas about that? My primary goal is to be able to update the fields in the headers and footers after changing custom proerties of the document

Thanks for any suggestions
Drew
 
Not obvious that these problem are related. Word documents that contain
hyperlinks do get slower and slower, the more of them that you use. I've
never found a fix other than to close and re-open. Unlikely that any code
that updates fields would be affecting that one way or the other.




dcozart said:
Code from Graham's website solved my problem, but created a new one. It
seems that navigation through the document has become exceedingly slow,
e.g., web navigation from table of contents. This is apparently due to the
macro. Any suggestions or ideas about that? My primary goal is to be able
to update the fields in the headers and footers after changing custom
proerties of the document.
 
The macro updates all the fields in the document, and this includes the TOC,
if you want to limit the update to the headers and footers you need to alter
the code to act only on those story ranges. Try the following code:

Sub UpdateHeader_Footer()

Dim oField As Field
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter

For Each oSection In ActiveDocument.Sections

For Each oHeader In oSection.Headers
If oHeader.Exists Then
For Each oField In oHeader.Range.Fields
oField.Update
Next oField
End If
Next oHeader

For Each oFooter In oSection.Footers
If oFooter.Exists Then
For Each oField In oFooter.Range.Fields
oField.Update
Next oField
End If
Next oFooter

Next oSection
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
Back
Top