hot links

J

judy rubin

How do convert a word in a document to a link.

Basically when I click on a word (other than an address)

it takes me to that page.

thank you

judy

urgent
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < judy rubin > écrivait :
In this message, < judy rubin > wrote:

|| How do convert a word in a document to a link.
||
|| Basically when I click on a word (other than an address)
||
|| it takes me to that page.
||

Like this:

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, _
Address:="", SubAddress:="Dest", _
ScreenTip:="Click to get there", _
TextToDisplay:="Next Page"

You need a bookmark where you want the link to point to. In this case, the
bookmark is "Dest" (The SubAddress).

Also, make sure that nothing is selected otherwise the "TextToDisplay"
argument will replace the currently selected text by, in this case, "Next
Page".
You may want to use

Selection.Collapse

before inserting the link, or use the Range object, as in the following
example:

'_______________________________________
Dim MyRange As Range

'Set the range to the second paragraph
'in the document
Set MyRange = ActiveDocument.Paragraphs(2).Range

'Collapse the range to the begining of the paragraph
MyRange.Collapse
'Insert a space
MyRange.InsertAfter " "
'Collapse again
MyRange.Collapse

'Insert the link at that spot
ActiveDocument.Hyperlinks.Add Anchor:=MyRange, _
Address:="", SubAddress:="Dest", _
ScreenTip:="Click to get there", _
TextToDisplay:="Next Page"
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

..
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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