Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
The following code is used in an Excel Macro and when ran in Excel2000
creates a valid hyperlink but in Excel2002 it does not. ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "\\S10AC52B\Eng\SCN\" & SCNFile, TextToDisplay:= _ "" & SCNNumber When SCNFile is set equal to "3PH-04011.xls" the hyperlink url that's created in Excel2000 looks like " \\S10AC52B\Eng\SCN\3PH-04011.xls" but when created in Excel2002 it looks like "..\..\Eng\SCN\3PH-04011.xls" Anyone have an idea as to why excel would change the url? How can I make it work correctly? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
Have you tried creating the hyperlink by inserting a "=HYPERLINK(...)"
formula into the cell ? sURL = "\\S10AC52B\Eng\SCN\" & SCNFile sText = SCNNumber selection.formula = "=HYPERLINK(" & sURL & "," & sText & ")" Tim. "Darrell Wesley" wrote in message ... The following code is used in an Excel Macro and when ran in Excel2000 creates a valid hyperlink but in Excel2002 it does not. ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "\\S10AC52B\Eng\SCN\" & SCNFile, TextToDisplay:= _ "" & SCNNumber When SCNFile is set equal to "3PH-04011.xls" the hyperlink url that's created in Excel2000 looks like " \\S10AC52B\Eng\SCN\3PH-04011.xls" but when created in Excel2002 it looks like "..\..\Eng\SCN\3PH-04011.xls" Anyone have an idea as to why excel would change the url? How can I make it work correctly? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
Tim,
Tried this and I get a "Application or User defined error" thrown at me when it hits the Selection.Formula line Looking at what this looks like when done manually: =HYPERLINK("\\s10ac52b\eng\scn\3ph-0412","3PH-0413") I may have to place some quote marks into it. "Tim Williams" wrote: Have you tried creating the hyperlink by inserting a "=HYPERLINK(...)" formula into the cell ? sURL = "\\S10AC52B\Eng\SCN\" & SCNFile sText = SCNNumber selection.formula = "=HYPERLINK(" & sURL & "," & sText & ")" Tim. "Darrell Wesley" wrote in message ... The following code is used in an Excel Macro and when ran in Excel2000 creates a valid hyperlink but in Excel2002 it does not. ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "\\S10AC52B\Eng\SCN\" & SCNFile, TextToDisplay:= _ "" & SCNNumber When SCNFile is set equal to "3PH-04011.xls" the hyperlink url that's created in Excel2000 looks like " \\S10AC52B\Eng\SCN\3PH-04011.xls" but when created in Excel2002 it looks like "..\..\Eng\SCN\3PH-04011.xls" Anyone have an idea as to why excel would change the url? How can I make it work correctly? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
Changing this to
selection.formula = "=HYPERLINK(""" & sURL & """,""" & sText & """)" allows this formula to be inserted and it at least works on my Excel2000. Will be trying it soon on a Excel2002 version. "Tim Williams" wrote: Have you tried creating the hyperlink by inserting a "=HYPERLINK(...)" formula into the cell ? sURL = "\\S10AC52B\Eng\SCN\" & SCNFile sText = SCNNumber selection.formula = "=HYPERLINK(" & sURL & "," & sText & ")" Tim. "Darrell Wesley" wrote in message ... The following code is used in an Excel Macro and when ran in Excel2000 creates a valid hyperlink but in Excel2002 it does not. ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "\\S10AC52B\Eng\SCN\" & SCNFile, TextToDisplay:= _ "" & SCNNumber When SCNFile is set equal to "3PH-04011.xls" the hyperlink url that's created in Excel2000 looks like " \\S10AC52B\Eng\SCN\3PH-04011.xls" but when created in Excel2002 it looks like "..\..\Eng\SCN\3PH-04011.xls" Anyone have an idea as to why excel would change the url? How can I make it work correctly? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
Yep - always happens when I don't test before posting..
Good luck with the 2002.. Tim "Darrell Wesley" wrote in message ... Changing this to selection.formula = "=HYPERLINK(""" & sURL & """,""" & sText & """)" allows this formula to be inserted and it at least works on my Excel2000. Will be trying it soon on a Excel2002 version. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink Excel2000 vs Excel2002
Tim,
Just to let you know it worked just fine with 2002. "Tim Williams" wrote: Yep - always happens when I don't test before posting.. Good luck with the 2002.. Tim "Darrell Wesley" wrote in message ... Changing this to selection.formula = "=HYPERLINK(""" & sURL & """,""" & sText & """)" allows this formula to be inserted and it at least works on my Excel2000. Will be trying it soon on a Excel2002 version. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel2002 | Setting up and Configuration of Excel | |||
Text book Excel2002 VBA | Excel Discussion (Misc queries) | |||
HYPERLINK URL PROBLEM (Excel2000 VS Excel2002) | Excel Programming | |||
VBA and comments in Excel2002 | Excel Programming |