Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula construction | New Users to Excel | |||
Array Construction | Excel Discussion (Misc queries) | |||
Construction Templates | Excel Discussion (Misc queries) | |||
formula construction w/ vba | Excel Programming | |||
formula construction | Excel Programming |