ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Open txt File and Import it to excel (https://www.excelbanter.com/excel-programming/332677-how-open-txt-file-import-excel.html)

Deepak

How to Open txt File and Import it to excel
 
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 H

How to Open txt File and Import it to excel
 
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

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com