View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
DGolds DGolds is offline
external usenet poster
 
Posts: 7
Default FollowHyperlink automatically

I'm not sure if this is what you're after, but rather than trying to do this
through the Worksheet_FollowHyperlink event, you can place the following code
in the macro of your choice (in your case, perhaps in the Worksheet_Change
event when the value of a certain cell meets a certain condition) to
hyperlink to the desired file or website
whenever the macro is run:

ThisWorkbook.FollowHyperlink "AddressToHyperlinkTo", , True

e.g.:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$5" Then
If Target.Value = 100 Then
ThisWorkbook.FollowHyperlink "C:\MusicFragment.mp3", , True
End If
End If
End Sub

HTH,
Dave

"Pieter-Jan" wrote:


I have seen that it is possible, with Visual Basic, to conditionally
follow a hyperlink.

How should the code be if, f.e. at A5=100 (sum of other cells),
automatically a hyperlink is followed? In my case a music fragment
should be played.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
????
????
????
????
End Sub

What comes in the place of the questionmarks to get this function
active?

Thanks.
Regards, Pieter-Jan


--
Pieter-Jan
------------------------------------------------------------------------
Pieter-Jan's Profile: http://www.excelforum.com/member.php...o&userid=27954
View this thread: http://www.excelforum.com/showthread...hreadid=474567