Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default programming a hyperlink

excel2000
i'm using a cell with a hyperlink to a website and 'calllng' it with a
command button,
Private Sub CommandButton3_Click()
Range("o17").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.WindowState = xlNormal
End Sub
i change the value of the website url based on the value entered in another
cell
Range("O17").Select
Selection.Hyperlinks(1).Address =
"http://www.ivolatility.com/options.j?ticker=" &
ActiveSheet.Range("stock_symbol").Value & ":NYSE&R=1&period=24&chart=2&vct="

this works ok but i would prefer not to have the cell containing the
hyperlink not visible to the user
but the only way i have found to implement the hyperlink is first 'insert'
the hyperlink into a cell, then change the value of the hyperlink address
programmatically, this always leaves the original entered url visible for
that cell
is there some other way to have a hyperlink, whose address i can change in
vba, that is not visible to the user??


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default programming a hyperlink


just use a hyperlink that points to itself

then trap FollowHyperlink event

ie:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Select Case Target.Range
Case [b3]
ActiveWorkbook.FollowHyperlink "http://www.microsoft.com"
End Select
End Sub



keepITcool

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


"bbxrider" wrote:

excel2000
i'm using a cell with a hyperlink to a website and 'calllng' it with a
command button,
Private Sub CommandButton3_Click()
Range("o17").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.WindowState = xlNormal
End Sub
i change the value of the website url based on the value entered in
another cell
Range("O17").Select
Selection.Hyperlinks(1).Address =
"http://www.ivolatility.com/options.j?ticker=" &
ActiveSheet.Range("stock_symbol").Value &
":NYSE&R=1&period=24&chart=2&vct="

this works ok but i would prefer not to have the cell containing the
hyperlink not visible to the user
but the only way i have found to implement the hyperlink is first
'insert' the hyperlink into a cell, then change the value of the
hyperlink address programmatically, this always leaves the original
entered url visible for that cell
is there some other way to have a hyperlink, whose address i can
change in vba, that is not visible to the user??




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default programming a hyperlink


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!
  #4   Report Post  
Posted to microsoft.public.excel.programming
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!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default programming a hyperlink


thanks again for the help, am having trouble keeping up with newsgroup,
its only giving me the current day, so if i miss a reply then the only
back to it seems to be thru developersdex
bbxrider

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default programming a hyperlink

dl a real newsreader like XNEWS (freeware & lots safer than OE)
then setup to server msnews.microsoft.com

keepITcool

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


robert betz wrote:


thanks again for the help, am having trouble keeping up with newsgroup,
its only giving me the current day, so if i miss a reply then the only
back to it seems to be thru developersdex
bbxrider

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Hyperlink result as working hyperlink Bod Excel Worksheet Functions 2 January 22nd 10 04:22 AM
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM
reading html when hyperlink address not hyperlink text diplayed Kevin Excel Programming 1 December 4th 03 10:13 PM


All times are GMT +1. The time now is 02:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"