Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Best way to format a flat file that Excel will load properly?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Best way to format a flat file that Excel will load properly?

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Best way to format a flat file that Excel will load properly?

On Sat, 9 Jan 2010 14:51:17 +1100, "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.



Using a sig AND being a top poster is a RETARDED combination as your
sig causes the message you responded to to get snipped.

You're an idiot. Either STOP using a sig as they are NOT even needed,
or STOP top posting, friggin idiot.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Best way to format a flat file that Excel will load properly?

Hi FatBytestard,

Have a nice day!

--
Cheers
macropod
[Microsoft MVP - Word]


"FatBytestard" wrote in message ...
On Sat, 9 Jan 2010 14:51:17 +1100, "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.



Using a sig AND being a top poster is a RETARDED combination as your
sig causes the message you responded to to get snipped.

You're an idiot. Either STOP using a sig as they are NOT even needed,
or STOP top posting, friggin idiot.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Best way to format a flat file that Excel will load properly?

On Mon, 11 Jan 2010 12:14:50 +1100, "macropod"
wrote:

macropod


What an idiot.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Best way to format a flat file that Excel will load properly?

I guess that's really a compliment from someone who wants to go down in history as FatBytestard!

--
Cheers
macropod
[Microsoft MVP - Word]


"FatBytestard" wrote in message ...
On Mon, 11 Jan 2010 12:14:50 +1100, "macropod"
wrote:

macropod


What an idiot.

  #7   Report Post  
Posted to microsoft.public.excel.programming
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


.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Best way to format a flat file that Excel will load properly?

It is not "right click and select open with excel".


You OPEN Excel, and select the "Data" tab and select "from text"

(you could record these moves in a macro too)

Also, your file should be a .csv file, NOT a .txt file, though either
will work.

csv is "comma separated values". If you already have a pre-parsed
file, give it the pre-parsed file extension name.

Anyway, opening Excel first and performing an import is the right way,
especially if you have several fields to define.


On Mon, 11 Jan 2010 13:03:02 -0800, ker_01
wrote:

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


.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Best way to format a flat file that Excel will load properly?

On Fri, 8 Jan 2010 16:55:01 -0800, ker_01
wrote:

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


If you are creating the text file, and you get to insert the
delimiters, then you can choose a character other than a comma, no
problem.

When you go to import it into an excel workbook (yes, this step is
required), you choose the delimiter that you constructed the text file
with, and it will import it perfectly every time as long as the character
you chose does not "pop up" in the data strings you are trying to import.

So, choose carefully.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to load web page into Excel properly? Eric Excel Discussion (Misc queries) 2 August 16th 09 04:55 PM
YYY-MM-DD format is changing when convert data to Flat File Bobby Excel Programming 3 June 23rd 09 12:25 PM
convert matrix to flat file format Felix Excel Discussion (Misc queries) 1 November 29th 07 02:11 PM
Repeated data into flat file format Paul Simon Excel Worksheet Functions 4 July 9th 06 04:33 AM
How to convert a Pivot Table into a Flat File format? [email protected] Excel Discussion (Misc queries) 1 February 22nd 06 05:17 PM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"