View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
ker_01 ker_01 is offline
external usenet poster
 
Posts: 395
Default Best way to format a flat file that Excel will load properly?

Thank you to macropod and Cellshocked for your responses.

I am now saving the file as a txt file, and have used commas to delimit the
file, and surrounded string fields with quotes so that 'accidental' commas
won't throw off the format.

When I right-click the file and say "open with Excel", it still throws each
entire row into column A.

Are there any tutorials on how to manually format a file output to be more
Excel-friendly, even (gack) if it means throwing it into XML format?

My alternative is to have Outlook create an instance of Excel, and dump the
contents directly into Excel instead of a flat file... but I'd be treading in
unfamiliar waters, given that this needs to work in a mixed 2003/2007
environment.

Thank you!!
Keith

"macropod" wrote:

Hi ker_01,

You can use a csv file by enclosing each field that might contain commas in double quotes.

Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel
tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.

--
Cheers
macropod
[Microsoft MVP - Word]


"ker_01" wrote in message ...
I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a
.txt file, although I hope to save it in a delimited flat file format with an
.xls extension so it will automatically be opened by excel without having to
go through the whole 'import' sequence.

There are string fields in the file, some of which contain commas- so I
can't make it a comma delimited file.

What is the best delimiter to use so that Excel will automatically recognize
and parse the flat file contents across columns?

Currently in 2003, but strongly prefer solutions that will also work in 2007

Many thanks,
Keith


.