View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default hyperlink prompt

I think I'd tweak your code like this (because people like to enter Y or N or
YES or NO or some other upper/lower case version of Y or N.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim Verify as VbMsgBoxResult

If Target.Range.Address = "$B$2" Then
Verify = Msgbox("Are you sure you wnat to leave me?",vbYesNo)
If Verify = VBNo Then
Application.Goto
End If
End If
End Sub


"Gary''s Student" wrote:

Save we have Inserted a hyperlink in cell B2. (we can't use the =HYPERLINK()
function here.)

Install the following event macro in the worksheet code area:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Target.Range.Address = "$B$2" Then
If Application.InputBox(prompt:="Are you sure you want to leave me??",
Type:=2) = "no" Then
Application.Goto
End If
End If
End Sub

If we type "no" we are back to B2, otherwise at are at the hyperlink
destination.
--
Gary''s Student - gsnu200851


"Libby" wrote:

Hi there,

Does anyone know if it's possible to prompt (Do you want to go to this link,
Yes No) before following a hyperlink?

Many thanks in advance.