Results 1 to 6 of 6

Thread: help mixing varibles with html

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    help mixing varibles with html

    Hi all i am trying to use the 3 varible call Line1,Line2,Line3 and keep getting syntax error . could you guys help me fix it .Thanks

    Code:
    Dim htm2 As String
    
        html2 = "<li>" & _
                   "<a href=" "&sLine1& "">" & _
                   "<img src=""&sLine2& "" alt="" /><br />"&sLine3& "</a><br />" & _
                   "</li><li>"
            
            RichTextBox1 = html2
    Last edited by tony007; May 7th, 2010 at 12:04 PM.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: help mixing varibles with html

    You say they are named Line1, Line2, Line3 but I only see you use sLine1 and sLine2.

    Also, you need spaces before and after & when doing string concatenation. And when you want to use a quotes character inside a quoted string you have to double it. For example: MsgBox """" will only display: "

    Try this corrected code:

    Code:
        html2 = "<li>" & _
                   "<a href=""" & sLine1 & """>" & _
                   "<img src=""" & sLine2 & """ alt="""" /><br />" & sLine1 & "</a><br />" & _
                   "</li><li>"
    Last edited by baja_yu; May 7th, 2010 at 12:04 PM.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: help mixing varibles with html

    Quote Originally Posted by baja_yu View Post
    You say they are named Line1, Line2, Line3 but I only see you use sLine1 and sLine2.

    Also, you need spaces before and after & when doing string concatenation. And when you want to use a quotes character inside a quoted string you have to double it. For example: MsgBox """" will only display: "

    Try this corrected code:

    Code:
        html2 = "<li>" & _
                   "<a href=""" & sLine1 & """>" & _
                   "<img src=""" & sLine2 & """ alt="""" /><br />" & sLine1 & "</a><br />" & _
                   "</li><li>"
    i edited my above post.how to use them inside such html ?

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: help mixing varibles with html

    Try the code I gave you.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: help mixing varibles with html

    Thanks it worked but how to do like this adding http before sLine1?


    Code:
    "<a href="http://www.somesite.com/id="" & sLine1 & """>" & _

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: help mixing varibles with html

    Read what I said about using quotes in strings (within quotes)

    if you want to write: <a href="http://www.somesite.com/id="
    to a string you have to double up those qoutes, so it would look like

    strA = "<a href=""http://www.somesite.com/id="""

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width