View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default programming a hyperlink

the trick:

the hyperlink in the sheet should point to itself,
it's just there to trigger the followhyperlink event.
where you can jump to anything you like without the user seeing it.


programmatically adding a selfpointing hl:

Sub ff()
Dim r As Range
Set r = [b3]
r = "ClickMe"
r.Hyperlinks.Add r, "", r.Address
End Sub

above code works in xl97 as it avoids the "TextToDisplay argument.
when coding for newer versions only, use:

Sub ff()
Dim r As Range
Set r = [b3]
r.Hyperlinks.Add r, "", r.Address,"ClickMe"
End Sub



My example FollowHyperlink handler in previous post must be (hard)coded
based on the hyperlink's anchor

However with a bit of ingenuity you could easily use the cell's contents
for a select case like

Select case Hyperlink.Range.Text
case "ClickMe"
etc


OR..
or use the commenttext in the same cell...
(hide the comment indicators in activesheet)

activeworkbook.followhyperlink hyperlink.range.comment.text


many ways to go to Rome...



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


robert betz wrote:


hi thanx for the reply
not exactly sure how that works, do you set the link url address the
same way as i have been?

but will experiment
bbxrider

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!