Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
|
|||
|
|||
How can I programmatically add a hyperlink to a cell in the excel ?
"fniles" wrote in message
... In VB6, using an Excel object, how can I programmatically add a hyperlink to a cell in the excel ? Set m_excelObjApp = CreateObject("excel.application") excelObjApp.Workbooks.Add sText = "http://www.myWeb.com" excelObjApp.ActiveWorkbook.ActiveSheet.Cells(1, 1).Value = sText I tried the following codes but got an error: If UCase(Left(sText, 4)) = "HTTP" Then excelObjApp.ActiveWorkbook.ActiveSheet.Hyperlinks. Add Selection, sText, sText End If dim oXL as excel.application dim oWB as excel.workbook dim oWS as excel.worksheet dim oHL as excel.hyperlink set oxl=createobject("excel.application") set owb=oxl.workbooks.add set ows=owb.worksheets(1) if ucase$(left$(stext,4))="HTTP" then set oHL=ows.hyperlinks.add(ows.cells(1,1),sText,,,sTex t) else ows.cells(1,1)=sText end if set ows=nothing set owb=nothing oxl.visible=true set oxl=nothing |
#2
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
|
|||
|
|||
How can I programmatically add a hyperlink to a cell in the excel ?
Thank you very much, that works !
"Bob Butler" wrote in message ... "fniles" wrote in message ... In VB6, using an Excel object, how can I programmatically add a hyperlink to a cell in the excel ? Set m_excelObjApp = CreateObject("excel.application") excelObjApp.Workbooks.Add sText = "http://www.myWeb.com" excelObjApp.ActiveWorkbook.ActiveSheet.Cells(1, 1).Value = sText I tried the following codes but got an error: If UCase(Left(sText, 4)) = "HTTP" Then excelObjApp.ActiveWorkbook.ActiveSheet.Hyperlinks. Add Selection, sText, sText End If dim oXL as excel.application dim oWB as excel.workbook dim oWS as excel.worksheet dim oHL as excel.hyperlink set oxl=createobject("excel.application") set owb=oxl.workbooks.add set ows=owb.worksheets(1) if ucase$(left$(stext,4))="HTTP" then set oHL=ows.hyperlinks.add(ows.cells(1,1),sText,,,sTex t) else ows.cells(1,1)=sText end if set ows=nothing set owb=nothing oxl.visible=true set oxl=nothing |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VSTO and Excel-- End Cell Edit Mode Programmatically? | Excel Programming | |||
How do I create a hyperlink to a cell with the hyperlink function | Excel Worksheet Functions | |||
script to hyperlink and reference a cell value in the hyperlink | Excel Programming | |||
excel - On hyperlink click find what cell or cell value is | Excel Programming | |||
How to programmatically make a cell the Active Cell? | Excel Programming |