Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Durham, North Carolina, USA
    Posts
    140
    Thanks
    5
    Thanked 1 Time in 1 Post

    Removing hyperlinking from TOC (Word XP)

    Howdy,

    Until last week I was a Word 97 user, but I've been upgraded to Word XP. In W97, when creating a TOC using the TOC field, ONLY the page number was hyperlinked. I've discovered (the hard way) that in Word XP, the entire entry (the text of the heading AND the page number) is hyperlinked. I've been ordered to make it behave the way it did in W97...but I'll be hanged if I can figure out how. There doesn't seem to be a field switch to disable this "feature".

    Anyone got a way to make Word XP TOCs behave like W97 TOCs?

    By the way...I wish I had a monopoly like MS does so I could make arbitrary changes affecting millions of customers without having to justify them. ;-)

    Thanks,

    Beej

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Removing hyperlinking from TOC (Word XP)

    hi Beej,

    you can press Alt+F9 to show the field codes & delete the h switch (and the /z switch too of it's there)
    and here's a macro solution i wrote some time ago.

    <pre>Sub DeleteHyperLinksFromTOC_TOF()
    Dim TOC As TableOfContents
    With ActiveDocument
    For Each TOC In .TablesOfContents
    With TOC.Range
    Do Until .Hyperlinks.Count = 0
    .Hyperlinks(1).Delete
    Loop
    With .Font
    .Underline = wdUnderlineNone
    .Color = wdColorBlack
    End With
    End With
    Next
    end with
    End Sub
    </pre>


  3. #3
    Lounger
    Join Date
    Aug 2003
    Location
    Baltimore, Maryland, USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Removing hyperlinking from TOC (Word XP)

    Thanks for the macro; it'll help when we get documents put together by others. Usually we use templates that include already de-hyperlinked TOC & TOF fields that only need updated after text is put into the new document -- I got tired of always de-hyperlinking them, then updating the field to get rid of the hyperlinks.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Removing hyperlinking from TOC (Word XP)

    Hi Beej:
    The only trouble with the macro solution (& I don't know enough about VBA to know how to overcome it) is that if you update the TOC, the h switch is still there. Try this:
    1. Show field codes (Alt+F9)
    2. Check use wildcards
    3. Find:
    ( [Tt][Oo][Cc]*)h*[!^21]
    4. Replace:
    1
    5. Select everything (Ctrl+A)
    6. Update fields (F9)

    I suppose you could record that as a macro. On second thought, you'd have to modify the macro to stop after one run or it would run infinitely. By the way, I only tested this on a couple of TOCs, so make sure you work on a copy first.

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Removing hyperlinking from TOC (Word XP)

    The "text" part being a hyperlink is caused by the h switch. Delete that and then update the TOC field and it should return to the old behavior. (At least, in my little test it does. <img src=/S/smile.gif border=0 alt=smile width=15 height=15> )

    As for the changes, at least you missed the earlier move from 97 to 2000. Think of all the extra brain cells you didn't waste. Of course, the learning curve (accidentally wrote curse the first time) is a bit steeper...

Posting Permissions

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