iNSERT A RELATIVE HYPERLINK using vba

A

arne

Can I insert a relative hyperlink in documents using vba? One that will
hyperlink to the main.htm in the same folder ?
(I have a lot of folders, and each of them contain one main.htm, while I
manually save the word converted htmfiles in the correct folder)
I am using word 2000

Sub tomain_arne()
' this is an absolute ref
' I want "E:\docweb\main.htm" to be inserted as a relative reference like
' <a href="main.htm">To main htm in samefolder 1</a>
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"E:\docweb\main.htm", SubAddress:="", ScreenTip:="To main htm in
samefolder", TextToDisplay:= _
"To Main"
End Sub

arne
 
J

Jezebel

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"main.htm", SubAddress:="", ScreenTip:="To main htm in
samefolder", TextToDisplay:= _
"To Main"
 

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