+ Reply to Thread
Results 1 to 4 of 4

TOC from page header?

  1. #1
    Registered User
    Join Date
    11-06-2016
    Location
    Sweden
    MS-Off Ver
    Office 2013
    Posts
    1

    Question TOC from page header?

    I have a word document with many pages. At the head of each page there is a text.
    Same text can be on many pages. If it's so, the same text is after each other.
    I have tried to create a table of contents of this text, but I am stuck completely.

    First I wanna create a blank first page. Then I wanna create a table of contents based on the
    page header text in the document.

    Ex:

    "Test text 1 from main page".........Page 1-3
    "Test Text 2 from main page".........Page 4
    "Test Text 3 from main page".........Page 5-7
    *
    and so on...

    How can I do that with VBA?

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: TOC from page header?

    That is not how Word works. A Table of Contents cannot be built from content anywhere other than the document body. Even then, the Table of Contents entry would only show where a topic starts, not the range it spans. You should apply one or more of Word's Heading Styles to the subject entries in the document body, and use a StyleRef field in to replicate whatever the relevant Heading Style displays in the header. A Table of Contents field can then automatically pick up the subject entries. It should be fairly obvious from where each new entry begins where the previous one ends...
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: TOC from page header?

    Cross-posted at: http://www.msofficeforums.com/word-v...ge-header.html and http://www.vbaexpress.com/forum/show...om-page-header

    Please read the Cross-Posting policy in rule #8: http://www.excelforum.com/forum-rule...rum-rules.html
    Last edited by macropod; 11-06-2016 at 08:57 PM.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: TOC from page header?

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why if you don't add the requested link to your opening post. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA header for only page two
    By HPIMICHAEL02 in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2016, 07:23 PM
  2. Replies: 7
    Last Post: 04-29-2013, 08:38 PM
  3. insert page header after page break
    By dgkindy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-17-2009, 10:35 AM
  4. Changing Page Header for each page of Dictionary
    By wali in forum Word Formatting & General
    Replies: 9
    Last Post: 02-09-2009, 01:01 PM
  5. Replies: 2
    Last Post: 01-16-2009, 05:24 PM
  6. Replies: 3
    Last Post: 03-29-2006, 12:50 PM
  7. [SOLVED] header and footer on every page except the first page?
    By marany in forum Excel General
    Replies: 3
    Last Post: 05-05-2005, 06:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1