Is your problem that your TOC fields are not updating or that you are not
getting the dialog box?
Version of Word?
The following updates TOC fields and TOA fields in the body of the document.
I don't know the field constant for a table of figures. Note, it will not
reach those in a header/footer nor in a text box. (This limitation also
applies to Ctrl-A, F9.) Macros do not give you the dialog box, I'm not sure
if Ctrl-A, F9 does or not.
Sub TOCFieldUpdate()
' Written by Charles Kyle Kenyon 27 January 2005
' Field Updater - TOC fields
Dim oField As Field
On Error Resume Next
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldTOC Then
oField.Update
End If
If oField.Type = wdFieldTOA Then
oField.Update
End If
Next oField
End Sub
The following should reach headers and footer or text boxes, haven't tested
with text boxes.
Sub TOCFieldUpdateAllStory()
' 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 = wdFieldTOA Then
oField.Update
End If
Next oField
Set oStory = oStory.NextStoryRange
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
--------- --------- --------- --------- --------- ---------
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.