Consulting

Results 1 to 7 of 7

Thread: Bookmark-Based Table of Contents

  1. #1
    VBAX Contributor
    Joined
    Aug 2012
    Posts
    120
    Location

    Bookmark-Based Table of Contents

    Hello, I was wondering if anyone might have an answer or alternative method for a Table of Contents (TOC) question. I have a macro that creates a planning book for the user that contains a given number of chapters depending on the user's needs for a project. Each chapter has a bookmark-based TOC on the first page of the chapter and it works really well.

    The question relates to the book's main TOC at the beginning. Each chapter is numbered, 1 through x, and each chapter's pages are numbered 1 through x. So, chapter 2 might have pages 1-5 and chapter 3 might have pages 1-3.

    It would be slick if the book's main TOC could be built the same way with the chapter name serving as each line item in the TOC which I'm confident can be done. The problem is the numbering system. For example, if chapter 1 is 5 pages and chapter 2 is 3 pages, then the TOC would look like this:
    Chapter 1 Title.....1
    Chapter 2 Title.....6

    I'd like it to look like this:
    Chapter 1 Title.....1
    Chapter 2 Title.....2

    Right now, I'm using an array to build the TOC in table form after the book has been completed but it takes more time, which is not a huge deal, and also has a slight problem in looks because the ....... borders don't work perfectly.

    Anyone have any ideas how to override that page numbering system in the bookmark-based TOC so that one can use the chapter numbers instead of the actual page numbers? Is there another alternative?

    Thanks for any ideas you might have.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    What is the logic behind the numbering you want? It doesn't seem to me it has any relation to the page numbering.

    If you use Section breaks between the Chapters, you could, of course, set each Chapter's Section to restart the page numbering at 1 (or any other number you'd like).
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Contributor
    Joined
    Aug 2012
    Posts
    120
    Location
    Hi, and thanks.

    Yes, I do a section break at the end of each chapter to restart the numbering process. I'm afraid I'm not explaining it well enough.

    In a normal book, say a book of 200 pages, you have the page numbering system go from 1-200. Chapter 1 has a starting page #1, Chapter 2 might start on page 20, Chapter 3 might start on page 55, and so on. The main TOC at the start of the book would look like this:
    Title.............Pg #
    Chapter 1.......1
    Chapter 2......20
    Chapter 3......55

    In my book, the page numbering is reset to 1 at the start of each chapter. Each chapter's bookmark-based TOC works very well. It's the main book TOC at the start of the book that I'm exploring options about.

    If I were to use the same 3-chapter example as described above, I would want it to look like this instead:
    Title...........Chptr#
    Chapter 1.......1
    Chapter 2.......2
    Chapter 3.......3

    Does that describe it better? I'm confident I can get the first result to work but I need the second version and I'm not sure that's possible in an automated TOC method, like the bookmark method.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by Mavila View Post
    In my book, the page numbering is reset to 1 at the start of each chapter. Each chapter's bookmark-based TOC works very well. It's the main book TOC at the start of the book that I'm exploring options about.

    If I were to use the same 3-chapter example as described above, I would want it to look like this instead:
    Title...........Chptr#
    Chapter 1.......1
    Chapter 2.......2
    Chapter 3.......3
    If the page #s are set to restart at 1 for each Chapter, you wouldn't have either of your TOC formats - you'd only ever get:
    Title.............Pg #
    Chapter 1.......1
    Chapter 2.......1
    Chapter 3.......1
    whatever approach you took.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Contributor
    Joined
    Aug 2012
    Posts
    120
    Location
    Yes, I know that. I just thought there might be a work-around to get where I wanted to go (each # would be the chapter #).

    I think I'll have to do something else. I've been looking at using a tab instead of the bookmark TOC or the table TOC (which I've been using). You can underline the tab space and that works pretty well except for this:

    Chapter 1..........1
    ...
    Chapter 10........10

    It should look like this:
    Chapter 1..........1
    ...
    Chapter 10......10

    I'm thinking I've got to either use a 01 number format (rather than simply, 1), or use a font (like courier new) where every character uses the same amount of space.

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Try using right-aligned tab-stops instead of left-aligned tab-stops.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  7. #7
    VBAX Contributor
    Joined
    Aug 2012
    Posts
    120
    Location
    OK, thanks for the tip.

Posting Permissions

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