Consulting

Results 1 to 3 of 3

Thread: Solved: string problem

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location

    Solved: string problem

    for --
    mstr = mstr & newstr & "/n/t"
    nest---

    I want multi line string
    like
    newstr1
    newstr2
    newstr3
    but above code gave
    newstr1/n/tnewstr2/n/t/newstr3/n/t

    How can i fix this problem?
    Thanks.

    Jeff

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    As I'm sure you have noticed, VB6/VBA does not support escape characters. This was introduced in .Net. You concatenate the line breaks in using character constants. The ones you are looking for are vbLf (Line Feed - ASCII 10), vbCr (Carriage Return - ASCII 13), & vbNewLine which is Char 13 then Char 10. If you are writing text files, or to text boxes you will generally want to use vbNewLine, if you writing to an excel cell then just use vbLf.
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  3. #3
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location
    Thanks. Aaron!

Posting Permissions

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