Word 97 & TTOC


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Word 97 & TTOC

  1. #1
    Nick Pinakis Guest

    Word 97 & TTOC


    Am using the following code to insert a TOC into a document at the insertion
    point of a bookmark ("start"). The only problem is when I change a heading,
    insert a page break etc in the document after the initial build of the table
    of contents I end with a second TOC after the first. I suspect I need somehow
    to delete/or replace the first TOC and with the new TOC. Would appreciate
    any assistance with the code I am using.

    Set myRange = ActiveDocument.Bookmarks("start").Range

    ActiveDocument.TablesOfContents.Add _
    Range:=myRange, _
    UseFields:=False, _
    UseHeadingStyles:=True, _
    LowerHeadingLevel:=3, _
    UpperHeadingLevel:=1, _
    AddedStyles:="myStyle, yourStyle"

  2. #2
    Paul Clement Guest

    Re: Word 97 & TTOC

    On 6 Jul 2000 00:56:19 -0700, "Nick Pinakis" <npp@fundi.com.au> wrote:


    Am using the following code to insert a TOC into a document at the insertion
    point of a bookmark ("start"). The only problem is when I change a heading,
    insert a page break etc in the document after the initial build of the table
    of contents I end with a second TOC after the first. I suspect I need somehow
    to delete/or replace the first TOC and with the new TOC. Would appreciate
    any assistance with the code I am using.

    Set myRange = ActiveDocument.Bookmarks("start").Range

    ActiveDocument.TablesOfContents.Add _
    Range:=myRange, _
    UseFields:=False, _
    UseHeadingStyles:=True, _
    LowerHeadingLevel:=3, _
    UpperHeadingLevel:=1, _
    AddedStyles:="myStyle, yourStyle"

    You may want to use the TableOfContents object's Delete (prior to Add) or Update method.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  3. #3
    Gary Cooper Guest

    Re: Word 97 & TTOC


    "Nick Pinakis" <npp@fundi.com.au> wrote:
    >
    >Nick when I create my TOC in word documents I add it when the document is

    finished. You can either use a bookmark or just go to start of document
    & insert TOC then new page break.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center