TOC using paragraph numbers instead of Page numbers

C

cmac

Essentially is it possible to create a TOC with paragraph number
instead of Page numbers?

I have some documents that end result will be converted into PDF an
then merged into other PDF files. Thus the TOC with its page number
will not be the same as the Adobe page numbers.

Anyones help is greatly appreciated. My Deadline is Monday to see i
it can be done. Yikes
 
D

Doug Robbins - Word MVP

The following will construction such a "table of contents" at the location
of the selection.

Dim i As Long, myheadings As Variant
Selection.Paragraphs(1).Alignment = wdAlignParagraphRight
i = Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
Selection.Paragraphs(1).Alignment = wdAlignParagraphLeft
Selection.Paragraphs(1).TabStops.Add i, wdAlignTabRight, wdTabLeaderDots
myheadings = ActiveDocument.GetCrossReferenceItems(wdRefTypeHeading)
For i = 1 To UBound(myheadings)
Selection.InsertCrossReference ReferenceType:="Heading", ReferenceKind:=
_
wdContentText, ReferenceItem:=i, InsertAsHyperlink:=True, _
IncludePosition:=False
Selection.TypeText Text:=vbTab
Selection.InsertCrossReference ReferenceType:="Heading", ReferenceKind:=
_
wdNumberFullContext, ReferenceItem:=i, InsertAsHyperlink:=True, _
IncludePosition:=False
Selection.TypeText Text:=Chr(13)
Next i


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top