Starting external excel macro

tnu

New Member
Hi!

I have macro in separate excel-file and it should format csv-file. Has anyone idea how should this be done. I have tried something like this:

DEF VAR vchExcel AS COM-HANDLE NO-UNDO.
DEF VAR vchWorkBook AS COM-HANDLE NO-UNDO.

CREATE "Excel.Application":U vchExcel.
ASSIGN vchExcel:VISIBLE = FALSE.
ASSIGN vchWorkBook = vchExcel:WorkBooks:OPEN("makro_formatting_report.xls").
vchExcel:Run("auto_open()", "input_file.csv").


RELEASE OBJECT vchWorkBook.
vchExcel:QUIT.
/* or -> RELEASE OBJECT vchExcel. */

but this seems to leave control to the macro-file. Running this externally
..excel.exe input_file.csv makro_formatting_report.xls works..

Regards Tero
 
oe10, office 2k3
this works for me

<snippet>
define var chExcelAppl as com-handle no-undo.
define var chWorkBook as com-handle no-undo.

create "Excel.Application" chExcelAppl.
chExcelAppl:Visible = yes.
chWorkbook = chExcelAppl:WorkBooks:Open( "book1.xls" ).
chExcelAppl:Run( "book1.xls!HelloWorld" ).

release object chExcelAppl.
release object chWorkBook.
</snippet>

when in doubt with office
turn on macro capture
and take a look at the vb code generated

degrassi rules !
 
Back
Top