View Single Post
  #1  
Old July 9th, 2004, 10:27 AM
Kathleen
external usenet poster
 
Posts: n/a
Default Can't update TOC programmatically (but it worked yesterday)

This is a strange one. I took the standard macro that
updates all fields in the doc from the Microsoft website.
Yesterday it worked. Today it doesn't. Any ideas what I
might have done to the doc to break it? (I can still
manually update the TOC).

Dim aStory As Range
Dim aField As Field

For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory

(By the way, despite what our friends at Microsoft say,
it doesn't update ALL fields, it misses out any that are
in the headers & footers but that's a different story.
bStory, perhaps? I have a workaround for that little
problem that *does* work, if anyone is interested)