Consulting

Results 1 to 2 of 2

Thread: Loop through TOC to make all page numbers right aligned

  1. #1
    VBAX Regular
    Joined
    Aug 2016
    Posts
    10
    Location

    Question Loop through TOC to make all page numbers right aligned

    I am having an issue with the TOC in some of my documents where the page number doesn't align to the right side of the page. The TOC has 2 tabs defined, a left-align tab for the text to move away from the section number and a right-align tab that is used for the actual page number. I would like to loop through each individual section title and test where the page numbers are located. If they are not at the right-aligned tab position, then add a tab which will then move the page number to the right. So, if anyone knows how to loop through each individual item in the TOC, can you please tell me?

    Chris

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    All you need do is modify the TOC Styles. No code or looping required. See, for example:
    http://www.msofficeforums.com/word/1...html#post52345
    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
  •