Announcement

Collapse
No announcement yet.

ASP, HTML, Excel

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ASP, HTML, Excel

    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!

  • #2
    Re: ASP, HTML, Excel

    This is the code that I am using where "Signatures" is the column that is displaying the text of each cell but doesn't include 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

    Comment


    • #3
      Re: ASP, HTML, Excel

      I would change the last line into this:
      Code:
      .Write " <td class='bodytext' nowrap>" & _
      "<a href=" & rs( "Signatures" ) & ">" & _
      rs( "Signatures" ) & "</a></td>" & vbCrlf
      Added code in Italic. Hope it's OK, I did not write ASP in last four years
      Last edited by sorinso; 23rd December 2008, 16:17. Reason: error in code ...

      Sorin Solomon


      In order to succeed, your desire for success should be greater than your fear of failure.
      -

      Comment


      • #4
        Re: ASP, HTML, Excel

        Originally posted by sorinso View Post
        I would change the last line into this:
        Code:
        .Write " <td class='bodytext' nowrap>" & _
        "<a href=" & rs( "Signatures" ) & ">" _
        rs( "Signatures" ) & "</a></td>" & vbCrlf
        Added code in Italic. Hope it's OK, I did not write ASP in last four years
        Hopefully the contents of "Signatures" is a URI and not just text. Otherwise the embedded href won't work.
        Last edited by ahinson; 23rd December 2008, 07:45.
        Andrew

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        Comment


        • #5
          Re: ASP, HTML, Excel

          You're right, Andrew. I somehow assumed (oh, my ) that the field contains the URI.
          If not, the value for the href should be changed. And again, if we're talking Web pages. If the links are to e-mail addresses, then the whole things changes...

          Sorin Solomon


          In order to succeed, your desire for success should be greater than your fear of failure.
          -

          Comment


          • #6
            Re: ASP, HTML, Excel

            Thank you all for your help.

            The contents of "Signatures" is a UNC path to a file in a folder. Something like \\main-srv-fnp-01\Compdirect\Signatures\signature.pdf.

            Hope that helps a little.

            Sorinso, thank you for the code. I am not a programmer so please bear with me if I ask "stupid" questions. I am getting this compilation error when running the code. Is there something that I am doing wrong? Again, thank you for your help guys!




            Microsoft VBScript compilation error '800a0401'
            Expected end of statement
            /company_directory/compdirectory.asp, line 109 rs( "Signatures" ) & "</a></td>" & vbCrlf^

            Comment


            • #7
              Re: ASP, HTML, Excel

              Actually it looks more like this:

              Microsoft VBScript compilation error '800a0401'

              Expected end of statement

              /company_directory/compdirectory.asp, line 109

              rs( "Signatures" ) & "</a></td>" & vbCrlf
              ^

              Comment


              • #8
                Re: ASP, HTML, Excel

                My appoligies again, the URI is like this:

                Signatures\test.pdf

                where signatures is a folder in the same directory as my ASP page.

                Comment


                • #9
                  Re: ASP, HTML, Excel

                  Post here please the code as you wrote it...
                  I already found an error in my previous code...

                  Sorin Solomon


                  In order to succeed, your desire for success should be greater than your fear of failure.
                  -

                  Comment


                  • #10
                    Re: ASP, HTML, Excel

                    That should be suitable for the href. There was a typo in the code that Sorinso gave you originally. It's missing an "&" which is probably why you are getting that error.

                    Code:
                    .Write "<td class='bodytext' nowrap><a href=" & rs("Signatures") & ">" & rs("Signatures") & "</a></td>" & vbCrlf
                    Last edited by ahinson; 23rd December 2008, 16:26.
                    Andrew

                    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                    Comment


                    • #11
                      Re: ASP, HTML, Excel

                      Indeed Sorry
                      I edited the post and added it (it is the last & in the second line).

                      Sorin Solomon


                      In order to succeed, your desire for success should be greater than your fear of failure.
                      -

                      Comment


                      • #12
                        Re: ASP, HTML, Excel

                        No problem Sorinso, you both have helped me out!

                        Thank you very much and have a wonderfull holiday!

                        Comment


                        • #13
                          Re: ASP, HTML, Excel

                          I'm sorry, its not pulling over the hyperlinks from the spreadsheet still. Its creating its own link such as: http://intranetsite/foldername/First...gnaturesColumn


                          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?

                          Comment


                          • #14
                            Re: ASP, HTML, Excel

                            Originally posted by joey74055 View Post
                            I'm sorry, its not pulling over the hyperlinks from the spreadsheet still. Its creating its own link such as: http://intranetsite/foldername/First...gnaturesColumn


                            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?
                            It should be putting http://url/signatures/test.pdf if rs("signatures") = the string "signatures\test.pdf".

                            You might need to give us more info to make this work.

                            How about some screenshots?
                            Andrew

                            ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                            Comment


                            • #15
                              Re: ASP, HTML, Excel

                              Thank you. I've got it now. If I type signatures\test.pdf in the cell as the text and have the hyperlink pointing to signatures\test.pdf everything works like a charm.


                              Thank you all for all of your help!

                              Comment

                              Working...
                              X