View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Load a CSV into an empty, formatted XLS?

Maybe you could drop the requirement that the COBOL program do it.

Set up a workbook with two sheets (instructions for the user and the actual
data).

Record a macro that does all the work in the second sheet.

The plop a button from the Forms toolbar onto the instruction sheet that calls
that macro.

You only have to rename the worksheet if you're doing File|Open (or the
equivalent in code). If you use the import external data stuff, you can leave
it named .csv.

Paul H wrote:

Thanks Dave,

I used your "import text" method and it does succeed in importing my .CSV
file into my empty .XLS file, in about 2 seconds. That is, after I
manually:

1. Open empty XLS file.
2. Data, import external data, import data.
3. "Select Data Source" screen comes up.
4. Type in my xxxx.TXT file name.
5. Import wizard step 1 - select delimited, then next.
6. Import wizard step 2 - select only Comma, then finish.
7. Import data to existing worksheet.
8. It imports the entire file in about 2 seconds, formatted correctly, with
columns as described in my empty .XLS file.

Now I need to figure out how to accomplish these steps automatically by my
COBOL program.

Thanks again,
Paul

================================================== =======
"Dave Peterson" wrote in message
...
If you rename the .csv file to .txt, you may be able to import the file
quicker
by setting each field the way you want.

Then you could format the numeric fields as percentages or whatever you
needed.

If you have fields that have implicit decimals, you could import them as
Generals and then put a factor of 10 (10, 100, 1000, ...) in an empty cell.
Edit|copy, edit|paste special|Values and divide (all in code) to convert
that
field.
================================================== =======
Paul H wrote:

I have an empty, formatted spreadsheet, that I created by writing a few
rows
into it from my COBOL program, field by field, then deleting all of the
rows.

The process of creating the entire XLS or XLSX runs much too slow (100
records per minute or less), and uses memory up, so can never allow me to
finish converting some of my large CSV files into formatted XLS (Excel
2003)
or XLSX (Excel 2007) files. Someone told me to "turn off continual
re-calculating". How?

I wonder if I can somehow import my large .CSV file into my .XLS empty
formatted file? I cannot find a way. Any help would be appreciated.

TIA, Paul


--

Dave Peterson


--

Dave Peterson