Auto update TOC and page number cross-references

F

Faith

Does anyone know of a way to have Word automatically update TOC fields and
page number cross-references within tables when a document is opened and/or
printed? I know the updates can be performed by selected the text and
pressing F9, but I don't want my readers of my doc to have to do this.
 
F

Faith

Thanks, Anne, but what I'm looking for (and it may not exist) is a way to
have Word automatically update all fields when the document is OPENED.

Do you know how to do this?

(By the way, I didn't know that a "Print Preview" updates the fields -- good
info!)
 
C

Charles Kenyon

The following macro will update TOC fields and REF fields.
Sub AutoOpen()
' Written by Charles Kyle Kenyon 15 November 2001
' repaired by Jezebel
' All Story Field Updater - TOC fields
Dim oField As Field
Dim oStory As Range
' On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
' This goes into headers and footers as well as the regular document
Do
For Each oField In oStory.Fields
If oField.Type = wdFieldTOC Then
oField.Update
End If
If oField.Type = wdFieldREF Then
oField.Update
End If
Next oField
Set oStory = oStory.Next
Loop Until oStory Is Nothing
Next oStory
End Sub
--
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://www.mvps.org/word 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.
 
F

Faith

No, I haven't because I'm not sure yet how Adobe will handle a macro. If
there's no such configuration within Word for handling the update upon
opening the doc, I guess I'll experiment with the macro.

Thanks!
 
F

Faith

Thanks, Charles!

Charles Kenyon said:
The following macro will update TOC fields and REF fields.
Sub AutoOpen()
' Written by Charles Kyle Kenyon 15 November 2001
' repaired by Jezebel
' All Story Field Updater - TOC fields
Dim oField As Field
Dim oStory As Range
' On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
' This goes into headers and footers as well as the regular document
Do
For Each oField In oStory.Fields
If oField.Type = wdFieldTOC Then
oField.Update
End If
If oField.Type = wdFieldREF Then
oField.Update
End If
Next oField
Set oStory = oStory.Next
Loop Until oStory Is Nothing
Next oStory
End Sub
--
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://www.mvps.org/word 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.
 

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