Read hyperlink in excel sheet in VB.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an excel sheet that have one of its cells as a hyperlink

I need to read this cell through Vb.net and get the value of the hyperlink
(the whole path ex: \\c:\document\..... ..... ... .. , not only the cell
content)

how can I do that

thanks for help
 
Hi Zino,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the hyperlink in an
Excel cell in VB.NET. If there is any misunderstanding, please feel free to
let me know.

As far as I know, when we have filled data from an Excel worksheet to a
.NET DataSet, all the values for this kind of field have been converted to
string type. Then, we cannot figure out which part is the hyperlink. Do you
have other contents in the same cell with the hyperlink which prevent you
from figuring it out?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi,

I think we may try to read the Hyperlinks by using automation.
The code below will print the cell(b5)'s hyperlink address and displayed
text.

Dim ex As New Excel.ApplicationClass
ex.Workbooks.Open("C:\temp\book1.xls")
Dim sheet As Excel.Worksheet = ex.ActiveSheet
Dim rg As Excel.Range = sheet.Cells(5, 2)
Debug.WriteLine(rg.Hyperlinks(1).Address)
Debug.WriteLine(rg.Hyperlinks(1).TextToDisplay)
ex.Quit()


You may have a try and let me know if that is what you want.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top