PDA

View Full Version : Table of Contents and Hyperlink base



alan_ay
11-19-2009, 04:18 AM
Hi All,

The table of content do not work when I set the hyperlink base.

For example, if I set the hyperlink base to C:\ My Documents

Then, when I click the headings in table of contents, it will go to C:\ My Documents but not the paragraph in the document.

Is the table of content can work with hyperlink base? If yes, how to do that?

Thank You

lucas
11-19-2009, 10:51 AM
Table of contents created with code or manually?

What version of Word?

You mention c:\mydocs as the hyperlink base so I'm confused. What would that have to do with a table of contents of a document?

If you can clarify a few things maybe we can help you sort this out.

alan_ay
11-19-2009, 06:33 PM
The table of content is created manually.

It is word 2002.

The hyperlink base is used for the hyperlink in the document but not the table of content.

However, the table of content do not work with hyperlink base.

After I set the base, the table of content will link to the base but not the topic in the document.

This problem can be solved by removing the hyperlink base.

However, is the hyperlink base can work with TOC?

Thank You for your help

macropod
11-20-2009, 04:10 AM
Hi alan_ay,

It is generally advisable to crete TOCs via a TOC field, rather than manually. Apart from anything else, TOC fields are not affected by the hyperlink base. Plus they update automatically to reflect changes in the document.

alan_ay
11-22-2009, 06:34 PM
Thanks for your reply.

The attachment is a doc file. I created a TOC in the doc by a TOC field. I also set the hyperlink base to C:\. The TOC do not work.

macropod
11-22-2009, 07:44 PM
Hi alan_ay,

OK, It seems the TOC is affected by the hyperlink base, after all. If you delete the hyperlink base, your TOC should work just fine - as should any other hyperlinks you have for locations within the same document.

alan_ay
11-22-2009, 08:46 PM
Hi macropod,

The TOC work fine if I remove the hyperlink base. However, is it possible for the TOC work fine with hyperlink base?

Thank you

macropod
11-22-2009, 10:20 PM
Hi alan_ay,

is it possible for the TOC work fine with hyperlink base?It seems not.

In any event, you can probably achieve the same result for hyperlinks in other ways. What are you doing that you believe needs the hyperlink base?

alan_ay
11-22-2009, 10:42 PM
It is because there are many hyperlinks in the doc. When this file move from the original directory to a new directory, these hyperlinks will not work. I need to create the hyperlinks again if I don't use the hyperlink base.


If I use the hyperlink base, I only need to change the base so the hyperlinks can work.

Thank You

macropod
11-22-2009, 11:27 PM
Hi alan_ay,

I think you'll find you can avoid the hyperlink base by using another technique for applying relative paths. To see how to implement relative paths in Word, check out the solution I've posted at:
http://lounge.windowssecrets.com/index.php?showtopic=670027 (mhtml:{2603C627-B617-484B-B3E3-521BCFB808E8}mid://00000598/!x-usc:http://lounge.windowssecrets.com/index.php?showtopic=670027)

geekgirlau
11-23-2009, 02:37 PM
I wish I'd known that 2 years ago - you'd laugh if you saw what I came up with at the time! :doh:

alan_ay
11-29-2009, 11:43 PM
Hi macropod,

Your solution is fine and it can solve my problem.

I also found another way to change the link. Press alt + F9 to display the field code. Then, change hyperlink field code. Finally, update the field.
This can also change the path of the links.

Thank you

macropod
11-30-2009, 12:15 AM
Hi alan_ay,

Yes, you can do that. In fact, I've written macros in the past that do essentially that for the purposes of editing field codes. Since pressing Alt-F9 exposes all field codes in a document, a simple Find/Replace operation is often all you need for the editing. After editing, pressing Alt-F9 to hide the field codes, then Ctrl-A, F9 will update all the fields.

TrippyTom
12-03-2009, 07:05 AM
macropod, this is just an FYI that your link above has some weird characters before the http:\\ that make it not work. I had to strip that part out to see the actual link.

macropod
12-03-2009, 02:19 PM
Hi TrippyTom,

I can't see any 'weird characters'. There is some vba express code behind the link to make it work (which you can see by hovering the mouse over the link), but clicking on the link takes me to the referenced site. Likewise, selecting, copying & pasting the link into another app (eg Notepad) returns a properly formatted web address.

fumei
12-03-2009, 03:19 PM
I had the same issue re: weird characters. I had to manually strip off:

mhtml:{2603C627-B617-484B-B3E3-521BCFB808E8}mid://00000598/!x-usc:

before the http: before it would work.


There is some vba express code behind the link to make it work (which you can see by hovering the mouse over the link), I do not see anything if I hover my mouse over the link.

Yes, you can copy and paste into another browser window. But actually clicking the link here puts:

mhtml:{2603C627-B617-484B-B3E3-521BCFB808E8}mid://00000598/!x-usc:http://lounge.windowssecrets.com/index.php?showtopic=670027

into the Address block...and then it sits there doing nothing.

fumei
12-03-2009, 03:20 PM
Interestingly, if I click the link in MY post (prefaced by the mhtml:{260.... crap), it does go directly to the real page.

macropod
12-03-2009, 03:27 PM
Hi fumei,

Curious.

If I click the link in my post (or your's), it tkes me direct to the windowssecrets page. The extra stuff does initially appear in the address bar, but gets stripped off after a moment. It also shows up in the (IE7) status bar if I hover over the link in my post.

In any event, the original link is not something I can edit now ...