Results 1 to 4 of 4

Thread: [RESOLVED] Using Quotation Marks In A String

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Resolved [RESOLVED] Using Quotation Marks In A String

    Is it possible to use quotation marks in a string? Is there some sort of variable that I can use like vbQuote or something because it won't work if you just use:
    VB Code:
    1. Call MsgBox("John Shouts "Hello"")
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Using Quotation Marks In A String

    Try this:
    VB Code:
    1. MsgBox "John shouts ""Hello"""
    Edit: You can also use Chr$(34) which is the ASCII value of ", eg
    VB Code:
    1. MsgBox "John shouts " & Chr$(34) & "Hello" & Chr$(34)
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Using Quotation Marks In A String

    this will insert quotes to the string:
    VB Code:
    1. MsgBox ("John Shouts " & Chr(34) & "Hello" & Chr(34))
    Show Appreciation. Rate Posts.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Using Quotation Marks In A String

    Thanx a lot guys, that should sort it out!
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

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