View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Creating a .csv file that will import to multiple worksheets

If you are asking if Excel can do this on it own, then the answer is No:
Excel expects all data in a such file to be in the same format and will
import to single worksheet. You can of course cut/paste (either manually or
in code) to produce the desired result.

Otherwise you will need to Open the file (check the VBA help for the Open
Statement), read a line and decide which file you are in from the header
info, then read line by line, unless the header tells you how many
lines/bytes you need to deal with.

If you can get the output file correctly formatted in Excel's version of
..csv, Excel can open .csv file directly, so no need for the steps.

NickHK

"mastermind" wrote in message
...
I have the following workflow:

1. An application program is creating several .csv files which have
header information on the 1st line and data on the subsequent lines.

There
are approximately 4 of these files.
2. In Excel, the users open each .csv file separately and go through
the format prompt to display the contents in a worksheet.

Question - can I create single CSV file that contains all 4 files(with
different column formats) that can be imported into Excel as separate
worksheets?

Thx.