PDA

View Full Version : Solved: string problem



jeff06
09-27-2007, 06:28 AM
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

Oorang
09-27-2007, 06:45 AM
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.

jeff06
09-27-2007, 08:44 AM
Thanks. Aaron!