Consulting

Results 1 to 2 of 2

Thread: Solved: Update a Word TOC from Excel VBA

  1. #1
    VBAX Mentor
    Joined
    Jan 2009
    Posts
    304
    Location

    Solved: Update a Word TOC from Excel VBA

    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.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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