+ Reply to Thread
Results 1 to 2 of 2

Updating table of contents takes a VERY long time even after repagination

  1. #1
    Registered User
    Join Date
    04-19-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Post Updating table of contents takes a VERY long time even after repagination

    I have a complex Word system that creates reports from both data feeds, which populate many tables and charts, and other Word documents which are previously-generated reports. I set background repagination off (Options.Pagination) After all is said and done, the macro repaginates (ThisDocument.Repaginate), saves, then updates the table of contents (ThisDocument.TableOfContents(1).Update), before saving and closing itself.

    The whole document generation for one test case takes 44 minutes to generate a 152-page document with many tables, charts, shapes, etc. Throughout the code there are many commands that write a time stamp and informational text into a log file. I've analyzed that log file, and I find that just updating the table of contents takes 36 minutes out of 44, 81% of the whole time!

    Is there any way to speed that up?

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Updating table of contents takes a VERY long time even after repagination

    That suggests you've inserted the Table of Contents via References | Table of Contents, using one of the 'Built-in' options. Whilst that approach has the advantage of adding a 'Table of Contents' heading for you, also inserts the Table of Contents into a content control container, which causes updates to be processed iteratively, one heading at a time. Far better to type your own 'Table of Contents' heading then insert the Table of Contents via References | Table of Contents > Insert Table of Contents or via Insert|Quick Parts|Field.

    There may be other issues with your process but, without seeing either the document or the code, it's impossible to advise. Note also that tables impose their own performance hit, especially if they have auto-sizing parameters for the tables themselves and/or the columns.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] msoFileDialogFolderPicker takes very long time to open first time
    By Jacc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2015, 08:00 AM
  2. Loop that takes a long time
    By batchjb69 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-26-2014, 09:00 AM
  3. Table add row operation takes a very long time
    By studiosa in forum Excel General
    Replies: 0
    Last Post: 05-30-2013, 10:50 AM
  4. Calculation takes long time
    By dorend in forum Excel General
    Replies: 10
    Last Post: 12-13-2011, 06:17 PM
  5. Clearing Cell contents takes unbelievably Long!
    By ions in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2007, 10:53 AM
  6. how do i add time to see how long my macro takes to run
    By ernestgoh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2006, 06:10 AM
  7. [SOLVED] Save takes long time
    By Jan in forum Excel General
    Replies: 2
    Last Post: 02-15-2006, 02:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1