How to Open txt File and Import it to excel

G

Guest

Hi,

How can I do the following usig VC++ 6.0 SP5 on Excel 2002 ?
The steps I manually perform are as follows. These are the steps I would
like to automate.

1) Launch Excel application
2) File-> Open-> select/choose a text file.
3) Import into excel - start importing from row 2
4) Set de-limiters for space/tab...etc
5) Run Macro
6) Graph results
7) Save the excel file as a workbook as somename.xls
8) Close the workbook ( which has only one worksheet )
9) Repeat the steps for different files.

I can successfully launch the excel app from my C++ code, which is a direct
rip-off from KB article. I can also launch a FileOpen dialog box. But Im
stuck here. I dont know how to read in the file name. Even if I assume, I can
supply the file names before hand and compile the project, how can I achieve
the rest ?

To elaborate >
Say, I have a file a1.txt I need to first do an import into excel, then run
a macro, graph, save as a1.xls or any such name, and close the workbook. and
then open a2.txt , start over again!

Thanks,
Ps: My main problem, is I cant seem to fnid the documentation of the methods
for classes such as _Application, _Workbok..etctec

Deepak
 
M

M H

Hi Deepak,

I'm not trying to offer a solution but I have the very similar issue to
address. Just have posted a request recently titled "automated file
loading and saving". I have only a little clue, but far from getting it
done. It would be much appreciated if you've already got yours done.

rgds,
Maurice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top