Posts: 42
Score: 0
Joined: 12/6/2006
From: Grand Rapids, MI
Status: offline
In MS Excel if you interactively type some text into a cell and then press Alt-Enter (both keys together) you get a line break in the cell and can start typing a 2nd line in the cell. So within a single cell it looks like:
line foo line bar etc.
I currently am converting a file of information into a comma delimited output file that I then want to open in Excel. One of the fields I am writing to this output file needs to embed the "magic" chr() code between the "line foo" and "line bar" strings above so that Excel will place both strings in the same cell with the line break in between the two strings. So my output should logically look like:
"... , line foo<line break char> line bar <line break char> etc... , ..."
I have searched the Internet and WSH online help but can't figure out how to do this.
Is it possible using a chr(num) value to produce the desired <line break char> above?
-Thanks, Terry Horwath
P.S. I have tried all the easy suspects: chr(9) thru chr(13). Some of these produce a special char "box" in the Excel field, while others force the 2nd, 3rd, etc. string patterns into a new cell in the first column.
< Message edited by thorwath -- 6/4/2008 2:12:55 PM >
Posts: 42
Score: 0
Joined: 12/6/2006
From: Grand Rapids, MI
Status: offline
That suggestion was the kick in the pants I needed! I got fixated on doing this with a comma delimited text file (as that is the common "currency" at this company where development works on AS400, Windows, Linux and Unix platforms--but I really only need this to work on the Windows platform).
I got it too work with only a few lines of code:
But I find the MS help file, VBAXL10.CHM, ponderous and difficult to work with. Is there a forum similar to this one, that anyone can recommend that is focused on MS Office Automation?