Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 1
Default 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
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
VSTO and Excel-- End Cell Edit Mode Programmatically? [email protected] Excel Programming 2 July 25th 06 06:47 AM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
script to hyperlink and reference a cell value in the hyperlink Natasha D. Excel Programming 5 May 17th 06 07:43 PM
excel - On hyperlink click find what cell or cell value is Mavrick Excel Programming 1 August 2nd 05 05:10 PM
How to programmatically make a cell the Active Cell? Jack Excel Programming 3 May 13th 04 04:30 PM


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