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?