Right now i've got a C++ DLL i've written to do various functions in another piece of software I'm using (Tradestation). Ideally, i'd like to be able to add a function call to the DLL that will open Excel -> open a work book in a fixed location -> (and preferably) automatically run a macro.

I know it's easy enough to order it to start Excel and open the workbook, but is it possible somehow to also get my DLL to order Excel to automatically run a macro?

04-04-2005

samGwilliam

Does Excel accept command line arguments?

04-05-2005

Fordy

2 ways

Use the ShellExecute API to open the xls file. If the spreadsheet has a macro called "AutoExec", rhen that macro will run automatically

Otherwise you need COM to create an instance of the Excel.Application object. This interface will offer methods to open workbooks, as well as to run macros