Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtaining the hyperlink from an Excel cell?

Status
Not open for further replies.

wluu

Programmer
Feb 21, 2003
7
CA
Hope someone can help me with this one. I have an asp page that connects to an excel file and displays the contents of the file from a range that I set. In one of the columns however, the values of the cell contains a string which also is a hyperlink. I can grab the string value, however I am not able to obtain the hyperlink value of the string. Can this be done? Here is a sample of my code:

sDBQ = "DBQ=\\PathHere\excelfile.xls"
sConnect = "DRIVER={Microsoft Excel Driver (*.xls)};" & sDBQ
sSource = "SELECT * FROM Gadget_Data"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSource, sConnect

The above is my connection to the file where Gadget Data is the range specified. I then make a for loop to display the value of each cell:

For each item in rs.Fields
Response.Write item.value & " "
Next
rs.movenext

Thanks in advance guys.

 
If your hypertext link already reads , then try using:

-------------------------------
For each item in rs.Fields

Response.Write &quot;<A href= '&quot;&item.value&&quot;'>&quot;&item.value&&quot;</A>&quot; & &quot;<BR><BR>&quot;

Next
rs.movenext
-------------------------------

** Note that there are single & double quote marks used in the first part of the anchor. Single quotes are in bold.
 
sysgrunt, the item.value only pulls in the text value of the cell. ie. if the cell had hello in the text with a link to item.value will write out hello only. I just don't know if it's possible to grab the value????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top