• Page Numbers come first in TOC (Word 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Page Numbers come first in TOC (Word 2003)

    • This topic has 2 replies, 2 voices, and was last updated 20 years ago.
    Author
    Topic
    #417620

    Dear All,

    Is it possible to create a TOC that has page numbers in front of the text? I cannot find such option within Word and I am just wondering if anybody has done it using VBA?

    Regards
    Rid

    Viewing 0 reply threads
    Author
    Replies
    • #937562

      There is no built-in feature to do that, but you could insert a standard TOC and convert it:

      Sub InsertTOCWithLeadingPageNumbers()
      Dim rng As Range
      Dim tbl As Table
      Set rng = ActiveDocument.TablesOfContents.Add _
      (Range:=Selection.Range, _
      RightAlignPageNumbers:=True, _
      UseHeadingStyles:=True, _
      UpperHeadingLevel:=1, _
      LowerHeadingLevel:=3, _
      IncludePageNumbers:=True, _
      AddedStyles:=””, _
      UseHyperlinks:=True, _
      UseOutlineLevels:=True).Range
      rng.Fields.Unlink
      Set tbl = rng.ConvertToTable _
      (Separator:=wdSeparateByTabs, _
      NumColumns:=2)
      tbl.Columns(2).Select
      Selection.Cut
      Selection.Paste
      tbl.ConvertToText Separator:=wdSeparateByTabs
      End Sub

      • #937574

        Thanks Hans,

        You are a life-saver.

        I was short of manually typing out the TOC.

        Regards
        Rid

    Viewing 0 reply threads
    Reply To: Page Numbers come first in TOC (Word 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: