Creating hyperlinks to heading styles with VBA?

M

Mark Krueger

I'm trying to automate creation of a code review document containing hyperlinks between several references to reviewed files in a review instructions document. I can't find a way to create the hyperlinks programatically

The document is setup so the review filename appears twice, once with Heading 2 and at a second location in the document (where all the review issues are entered) with Heading 1. Manually I can use Insert Hyperlink to hyperlink the two occurrances to each other

Creating macros using the Insert Hyperlink button gives the following two code snippits, Note the SubAddress of the second hyperlink has "_1" appended to it, but otherwise is the same. But I can't seem to create valid values for SubAddress if I don't use the Insert Hyperlink dialog to create the hyperlink.

We need to review a large number of files (75 in the last review), and it takes a lot of time and patience to set all the hyperlinks up. I'd really like to find a way to automate this

Thanks for your time. - Mar

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="",
SubAddress:="_TS_GetFlightRecorder.vi,__14", ScreenTip:="", TextToDisplay
:="TS_GetFlightRecorder.vi, 14

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="",
SubAddress:="_TS_GetFlightRecorder.vi,__14_1", ScreenTip:="",
TextToDisplay:="TS_GetFlightRecorder.vi, 14
 
W

Word Heretic

G'day Mark Krueger <[email protected]>,

Ignore the recorder, use

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range,
Address:="SomeURL/UNC/Etc/file.doc"

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Mark Krueger reckoned:
 

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