Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default 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
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
Having a cell prompt for a hyperlink wellsrp Excel Worksheet Functions 1 August 28th 07 01:38 PM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... dollardoc Excel Programming 1 April 7th 05 12: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 03:24 PM.

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"