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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Help

Status
Not open for further replies.

joey74055

IS-IT--Management
Jul 23, 2008
10
US
Hello, wondering if someone could point me in the right direction. I need to pull over data on an excel spreadsheet

to a HTML page. That part all works and looks fine. The one little wrinkle I have is that one column in the

spreadsheet are hyperlinks. The names come across to the HTML but not the links, I need these links to come across.

Is there a way to accomplish this?
I have a spreadsheet with 5 coliumns. Each column is in a "range". I am using this code to pull from my cell range:

RS.open "SELECT * FROM my_range", oConn

A "Responce.Write" command writes the data from each column to the html formatted web page. However, the 5th column,

which are hyperlinks on the spreadsheet justs pulls over the text of the cells, not the text with the hyperlinks.
Any help would be great!


This is the code I am using where "Signatures" is the column with the hyperlinks. The text of the hyperlink names from each cell, just not the links.


RS.open "SELECT * FROM my_range", oConn

do until RS.EOF
' Response.Write ( RS("NAME") & RS("Ext") & RS("Dept") & RS("Location") & RS("Signatures")& "")

WITH Response
.Write " <tr onMouseover=" & Chr(34) & "this.bgColor='#FFFF99'" & Chr(34) & "; onMouseout=" & Chr(34) & "this.bgColor=document.bgColor;" & Chr(34) & ">" & vbCrlf
.Write " <td class='bodytext' nowrap><a href='mailto:" & RS( "Name") & "'>" & rs( "Name") & "</a></td>" & vbCrlf
.Write " <td class='bodytext' nowrap>" & rs( "Ext" ) & "</td>" & vbCrlf
.Write " <td class='bodytext' nowrap>" & rs( "Dept" ) & "</td>" & vbCrlf
.Write " <td class='bodytext' nowrap>" & rs( "Location" ) & "</td>" & vbCrlf
.Write " <td class='bodytext' nowrap>" & rs( "Signatures" ) & "</td>" & vbCrlf
END WITH
 
.Write "<td class='bodytext' nowrap><a href='" & rs( "Signatures" ) & "'> & rs("Signatures") & "</a></td>" & vbCrlf

If you are writing to HTML and using a table structure you probably have a reason for the vbCrlf's but I don't know what it is.
 
Please forgive me, I am not a programmer just trying to add something to an exsisting company intranet that mgmt wants. This is the error I am getting with the above code. Any suggestions on wha tI might be doing wrong? Thank you soooo much for your help BigRed1212 !

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/company_directory/compdirectory.asp, line 107

.Write " <td class='bodytext' nowrap><a href='" & rs( "Signatures" ) & "'> & rs("Signatures") & "</a></td>" & vbCrlf
----------------------------------------------------------------------------------------^
 
Sorry.

Forgot a set of quotes.

Try this.


Write "<td class='bodytext' nowrap><a href='" & rs( "Signatures" ) & "'>" & rs("Signatures") & "</a></td>" & vbCrlf
 
I'm sorry, its not pulling over the hyperlinks from the spreadsheet still. Its creating its own link such as:




Instead of pulling over the actual link that I manually gave each cell such as:

signatures\test.pdf





Any thoughts, do i need to put something different than the "Signatures" in the <a href> section of the code?
 
The code will take the content of the field Signatures for each record and write that with anchor tags around it making the content the destination address.

If the Excel cell says "test.pdf" and the hyperlink associated with it says "test.pdf" the code will write

<td class='bodytext' nowrap><a href='test.pdf'>test.pdf</a></td>

If the Excel cell says "johnny jumpup" and you have made a manual hyperlink on that cell and typed in something else like test.pdf, you have a more difficult task.

I assumed the content of the cell was the address you wanted the link to point to.

There is probably a proper way to do it. I don't know what that is. I would probably create a macro in Excel that would copy the hyperlink to the right of each signature cell and then bring the file in with another field.

Then write it out as

<td class='bodytext' nowrap><a href='copied hyperlink text from new field here'>original text from signatures field here</a></td>
 
Ok, thank you very much for all of your help. If I type into the cell the same path that that cell is hyperlinked to it pulls up the pdf from the hyperlink. Again, thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top