View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_6_] Gareth[_6_] is offline
external usenet poster
 
Posts: 158
Default Exporting to txt file, how to insert a "Enter" between lines

Hi Kim,

Do you mean you need to have a blank line between each line in the text
file? Using the SaveAs tab delimited won't normally give you that unless
(as you have already pointed out) you have a blank *row* between each one.

As one solution you could force the "Enter" (actually a carriage return
and a line feed) by inserting it in the last cell of a row by having
=CHAR(13) & CHAR(10) in the last cell at the end of the row.

e.g.
What HowMany HowMuch FakeEnter
Monkeys 20 500 =CHAR(13) & CHAR(10)
Giraffes 5 1000 =CHAR(13) & CHAR(10)

Unfortunately, because these are "special" characters, when you save as
text it will insert quotes before and after them (try it and see). The
only way to get around this is to save as Space Delimited (*.prn) - you
can change the prn extension to txt when you save by typing your
filename in quotes e.g. "mynewfile.txt". If MYOB can accept this, then
this should be a good workaround for you.

Alternatively, you could do this more cleanly using VBA - this is the
programming NG after all. If you are familiar with VBA and want to try
that please post back. (Or check out the Open #, Print #, Close #
functions in VBA help.

HTH,
Gareth



fidller wrote:
Hi
I need to export a spreadsheet to a text file, (tab delimited) for
importing into our accounting program (MYOB).
The accounting program needs an "Enter" between lines to recognize next
customer.
How do I do this from within Excel

I can do it by having a empty cell between each entry, just does not
seem very elegant

Cheers
Kim