Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

TOC and Field Update Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Deborah C - 02 Nov 2005 00:11 GMT
Hi All,

I had some 'Update All' Macros set up in all my document templates that have
suddenly stopped working.  I've given up trying to figure out why now, I just
want to fix the problem.  These templates are used as the basis for many
documents.

I'm on Word 2000 9.0.6926 SP3.  Nothing has changed for me in years, but
other people in the office are starting to get XP - maybe that is making a
difference?

The macro that used to work was:
   Selection.WholeStory
   Selection.Fields.Update
   Selection.HomeKey Unit:=wdStory

Now that doesn't seem to do much at all.

So I tried a different macro, but got "Run time error -2147467259
(800004005) Method 'update' of object 'table of contents' failed"
Sub UpdateAll()
  Dim aStory As Range
  Dim aField As Field
  ActiveDocument.TablesOfContents(1).Update
  For Each aStory In ActiveDocument.StoryRanges
     For Each aField In aStory.Fields
        aField.Update
     Next aField
  Next aStory
End Sub

If I take the TOC part out, it updates everything in the document except the
TOC.

Can anyone point me in the right direction here?
Deborah C - 02 Nov 2005 06:39 GMT
Never mind, I found the solution myself :)

One of the macros in the document was called UpdateFields - when I renamed
it all my problems went away!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.