Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Hyperlink Construction and Execution

I built a hyperlink in a cell that works fine when I click on the cell that
looks like this

=HYPERLINK(CONCATENATE("http://",'Toolkit Setup'!$A$16,"/",'Toolkit
Setup'!$M$12),"Agent "&'Toolkit Setup'!$M$12&" WEB Site")

In a macro I am trying to execute this but it fails with a subscript out of
range on the Selection.Hyperlinks(1).Follow

' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hyperlink Construction and Execution


Marvin;7275492 Wrote:
I built a hyperlink in a cell that works fine when I click on the cell
that
looks like this

=HYPERLINK(CONCATENATE("http://",'Toolkit Setup'!$A$16,"/",'Toolkit
Setup'!$M$12),"Agent "&'Toolkit Setup'!$M$12&" WEB Site")

In a macro I am trying to execute this but it fails with a subscript
out of
range on the Selection.Hyperlinks(1).Follow

' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1It may be because its not actually set up like this



Code:
--------------------
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"Sheet1!A1", TextToDisplay:="Sheet2!A1"
--------------------
so your not following a cell hyperlink you are accessing a worksheet
formula!

Regards,
SImon


--
Simon Lloyd
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Hyperlink Construction and Execution

Since the Hyperlink is built one time dynamically, I need to execute what is
built in A17. I tried using the ADD Hyperlink but it does not return an error
or the WEB site. So basically nothing happens. It may have something to do
with the address parameter but I am stuck on how to proceed. This is what I
have now....
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''
Sheets("Toolkit Setup").Select
' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
ActiveSheet.Hyperlinks.Add Anchor:=Range("a17"), Address:="",
SubAddress:= _
"'Toolkit Setup'!A17", TextToDisplay:="Agent WEB Address"
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''
"Simon Lloyd" wrote:


Marvin;7275492 Wrote:
I built a hyperlink in a cell that works fine when I click on the cell
that
looks like this

=HYPERLINK(CONCATENATE("http://",'Toolkit Setup'!$A$16,"/",'Toolkit
Setup'!$M$12),"Agent "&'Toolkit Setup'!$M$12&" WEB Site")

In a macro I am trying to execute this but it fails with a subscript
out of
range on the Selection.Hyperlinks(1).Follow

' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1It may be because its not actually set up like this



Code:
--------------------
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"Sheet1!A1", TextToDisplay:="Sheet2!A1"
--------------------
so your not following a cell hyperlink you are accessing a worksheet
formula!

Regards,
SImon


--
Simon Lloyd

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Hyperlink Construction and Execution

Got it working with the following changes. Thanks for your help

A17 has...
="http://"&'Toolkit Setup'!$A$16&"/"&'Toolkit Setup'!$M$12

Macro Looks Like This
On Error GoTo NoInternet
Dim DynamicHyperlink As String
Application.ScreenUpdating = False
Sheets("Toolkit Setup").Select
DynamicHyperlink = Range("A17").Value
' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
ActiveSheet.Hyperlinks.Add Anchor:=Range("A17"), Address:=DynamicHyperlink
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1
NoInternet:
MsgBox "Internet Could Not Be Reached At This Time " & Err.Description
Exit_1:

"Marvin" wrote:

I built a hyperlink in a cell that works fine when I click on the cell that
looks like this

=HYPERLINK(CONCATENATE("http://",'Toolkit Setup'!$A$16,"/",'Toolkit
Setup'!$M$12),"Agent "&'Toolkit Setup'!$M$12&" WEB Site")

In a macro I am trying to execute this but it fails with a subscript out of
range on the Selection.Hyperlinks(1).Follow

' If no Agent web site then Alert and Exit
If [A17] < "" Then
Range("A17").Select
Selection.Hyperlinks(1).Follow
GoTo Exit_1
Else
MsgBox "Agent WEB Site Missing From Toolkit Setup", , "Agent WEB Site
Access"
End If
GoTo Exit_1

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hyperlink Construction and Execution


Marvin;7283089 Wrote:
Got it working with the following changes. Thanks for your help

Glad you got sorted, Thanks for posting back Marvin.

Regards,
Simon


--
Simon Lloyd
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
formula construction Robert-the-Bruce New Users to Excel 7 June 9th 07 08:12 PM
Array Construction M Moore Excel Discussion (Misc queries) 1 July 23rd 06 11:28 PM
Construction Templates denhar Excel Discussion (Misc queries) 0 June 15th 05 05:59 PM
formula construction w/ vba Gixxer_J_97[_2_] Excel Programming 5 June 7th 05 02:13 PM
formula construction Gixxer_J_97[_2_] Excel Programming 2 February 15th 05 02:43 PM


All times are GMT +1. The time now is 02:13 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"