![]() |
#9
|
||||
|
||||
![]()
OK, so hiding the page #s isn't going to do what you need anyway.
In that case, what you probably need is a macro like the following to convert the TOC to hyperlinks. Do note, though, that hyperlinks don't update the way TOC fields do, so it's probably best to not do the conversion until the document is otherwise finalised. Code:
Sub ConvertTOC2Hyperlinks() Dim RngTOC As Range, RngItem As Range, StrBkMkList As String, StrTmp As String, i As Long With ActiveDocument With .TablesOfContents(1) .Update For i = 2 To .Range.Fields.Count StrBkMkList = StrBkMkList & "|" & Split(Trim(.Range.Fields(i).Code.Text), " ")(1) Next Set RngTOC = .Range End With RngTOC.Fields.Unlink For i = 1 To UBound(Split(StrBkMkList, "|")) Set RngItem = RngTOC.Paragraphs(i).Range RngItem.End = RngItem.End - 1 StrTmp = Replace(Split(StrBkMkList, "|")(i), "Toc", "HL") .Bookmarks.Add Name:=StrTmp, Range:=.Bookmarks(Split(StrBkMkList, "|")(i)).Range .Bookmarks(Split(StrBkMkList, "|")(i)).Delete .Hyperlinks.Add Anchor:=RngItem, SubAddress:=.Bookmarks(StrTmp).Range, _ TextToDisplay:=.Bookmarks(StrTmp).Range.Text Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
table of contents, toc, toc hyperlinks |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
hyperlinks in a table | eNGiNe | Word | 10 | 12-05-2012 04:02 PM |
![]() |
Shakes | Word | 2 | 10-24-2012 08:21 AM |
![]() |
Abacaxi | Word | 3 | 04-18-2012 12:24 AM |
![]() |
viuf | PowerPoint | 13 | 02-19-2012 10:34 AM |
Word with frames, table of contents, and hyperlinks to html | NHMC | Word | 0 | 12-09-2009 12:54 PM |