Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
hyperlink prompt
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
hyperlink prompt
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
hyperlink prompt
Thanks for your comments. However the link is to an external file and when I
run the code it executes after the file has been opened. "Barb Reinhardt" wrote: 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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
hyperlink prompt
Just to say that I've found how to do it at this site:
http://www.ozgrid.com/forum/showthread.php?t=78124 It works well, but relies on the hyperlink being created with no address, a sub address of the cell it's in and the path you really want to follow in the screen tip. "Libby" wrote: Thanks for your comments. However the link is to an external file and when I run the code it executes after the file has been opened. "Barb Reinhardt" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Having a cell prompt for a hyperlink | Excel Worksheet Functions | |||
save prompt for user exit, but no save prompt for batch import? | Excel Discussion (Misc queries) | |||
Intra-workbook hyperlink: macro/function to return to hyperlink ce | Excel Discussion (Misc queries) | |||
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... | Excel Programming | |||
reading html when hyperlink address not hyperlink text diplayed | Excel Programming |