![]() |
Programatically Creating a Hyperlink Using VB.Net ?
I am going nuts trying to create a spreadsheet using VB.Net. It all
seems to work EXCEPT for a column which has to contain a hyperlink. I've spent more than 6 hours researching this but just haven't found the right incantation. Here's the VB.Net code which puts a row of data to Excel ... astrRow(0) = oc.name astrRow(1) = oc.tel astrRow(2) = oc.tel2 astrRow(3) = oc.age astrRow(4) = oc.mts astrRow(5) = "=HYPERLINK(""" & oc.PhotoUrl & """)" 'astrRow(5) = oc.PhotoUrl 'astrRow(5) = "=HYPERLINK(""" & oc.PhotoUrl & """,""" & oc.PhotoUrl & """)" XLRow += 1 objSheet.Range("A" & XLRow.ToString, "F" & XLRow.ToString).Value = astrRow What I see in column F of the spreadsheet is ... =HYPERLINK("http://www.confidentialwebsite.com/s_01.jpg") Clicking on one of these cells generally does nothing. Sometimes if I make a trivial editing change to one of these cells then Excel will display the cell as a hyperlink but it is still unable to actually follow the link. PLEASE ... if you can help me resolve this I would sure appreciate it. Thanks, Bob |
Programatically Creating a Hyperlink Using VB.Net ? RESOLVED
Well ... after further butting of my head against the brick wall, the
wall finally crumbled. The trick was to use objSheet.Range().Formula instead of objSheet.Range().Value. I found the answer in VBA doc when that seemed to be the only place I hadn't looked. I have no idea if it valid, in general, to use VBA methods in VB.Net, but this Formula method seems to work. Bob On Sun, 28 Nov 2004 19:42:16 -0500, eBob.com wrote: I am going nuts trying to create a spreadsheet using VB.Net. It all seems to work EXCEPT for a column which has to contain a hyperlink. I've spent more than 6 hours researching this but just haven't found the right incantation. Here's the VB.Net code which puts a row of data to Excel ... astrRow(0) = oc.name astrRow(1) = oc.tel astrRow(2) = oc.tel2 astrRow(3) = oc.age astrRow(4) = oc.mts astrRow(5) = "=HYPERLINK(""" & oc.PhotoUrl & """)" 'astrRow(5) = oc.PhotoUrl 'astrRow(5) = "=HYPERLINK(""" & oc.PhotoUrl & """,""" & oc.PhotoUrl & """)" XLRow += 1 objSheet.Range("A" & XLRow.ToString, "F" & XLRow.ToString).Value = astrRow What I see in column F of the spreadsheet is ... =HYPERLINK("http://www.confidentialwebsite.com/s_01.jpg") Clicking on one of these cells generally does nothing. Sometimes if I make a trivial editing change to one of these cells then Excel will display the cell as a hyperlink but it is still unable to actually follow the link. PLEASE ... if you can help me resolve this I would sure appreciate it. Thanks, Bob |
All times are GMT +1. The time now is 01:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com