Quotations And Similar Characters In Strings

  • Hey all,


    I've got a strange problem I can't get around. A program requires that I put any website references in a very specific way, so:


    http://www.ozgrid.com


    would have to appear as:


    \`"www.ozgrid.com"\`


    The code I have for it follows:

    Code
    1. tempString="\`"""www.ozgrid.com"""\`"


    The character after the backslash, I'm not what its called, is the one above the 'tab' key on the keyboard.


    the problem is: "Expected: end of statement", with the www highlighted.


    any help would be much appreciated

  • Re: Quotations And Similar Characters In Strings


    Hi,


    May be you could try concatenation with char(96) ...


    HTH
    Carim

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Re: Quotations And Similar Characters In Strings


    Hi,


    Below is a tested code which works fine ...

    Code
    1. Sub Testsit()
    2. Dim tempString As String
    3. tempString = "\" & Chr(96) & """www.ozgrid.com""" & "\" & Chr(96)
    4. Range("A1").Value = tempString
    5. End Sub

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Re: Quotations And Similar Characters In Strings


    This seems ot work also:

    Code
    1. tempString = "\`""www.ozgrid.com""\`"


    Tested with:

    Code
    1. Sub test()
    2. Dim tempString As String
    3. tempString = "\`""www.ozgrid.com""\`"
    4. MsgBox tempString
    5. End Sub
  • Re: Quotations And Similar Characters In Strings


    Figured it out, had made a fairly dumb mistake - had put three quotation marks instead of two when I needed it in the center of the text. Three is only for beginning or end I guess.