Message Boards
Chr(13) in text output, so two lines appear in one cell in excel
Edward Visser, modified 3 Years ago.
Chr(13) in text output, so two lines appear in one cell in excel
Post Date: 2/4/17 (Silver, 44 Posts) Recent PostsSorry, I can't get an image added to my post, so I'll try to describe :
I want to create a text, in which the Chr(13) is and after importing in excel, I want it to be one line of text in one cell. However, when I put text wrap on the cell, it should appear as two lines.
I don't know if I should do something special in my code to create the output and/or I should do something special on my import in excel
Okay, it took me quite some hours, but I found a way to create what I want.
It's not the problem to create a text file that contains the CHR(10) or 13, but importing the data into excel. Not by opening the file from Windows Explorer, but by importing the file from text, it kept using the 10 or 13 to step to a new cell.
With this code you create a formula in the text file
DEFINE VARIABLE sText AS CHARACTER FORMAT "x(50)".
stext = "=" + CHR(34) + "John" + CHR(34) + CHR(38) + "TEKEN(10)" + CHR(38) + CHR(34) + "Templeton" + CHR(34).
PUT stext SKIP.
Results in a text file containing :
="John"&TEKEN(10)&"Templeton"
Which results (after importing the data from text file AND formatting the column to wrap the text) in the desired text string over two lines in one cell.
However, if anyone does know a simpler solution....please let me know!!!
Message place holder
Forums