PDA

View Full Version : Solved: Update a Word TOC from Excel VBA



JimS
08-05-2009, 11:19 AM
I have an Excel Workbook that opens a Word Document and then copies/pastes several Charts from Excel Workbook into the Word Document at various Bookmarks automatically.

Is it possible to update the Word's "Table of Contents" from Excel?

I've tried variations of this but I can't get it to work:

appWrd.ActiveDocument.TablesOfContentstoc.Update


Thanks...

Jim

PS: Wasn't sure if this should have been posted under the Word Forum.

macropod
08-05-2009, 07:48 PM
Hi Jim,

Assuming there's exactly one TOC:
appWrd.ActiveDocument.TablesOfContents(1).Update
or, if it's just the page numbers you need to update:
appWrd.ActiveDocument.TablesOfContents(1).UpdatePageNumbers