So Lynn, are you done with C# or just spreading your wings?
An alternative would be to have a module named (say) "m_OpenClose" in your xlsm
'Startup code here executes when the workbook is opened
End Sub 'Auto_Open
'Cleanup code here
In your C++ app:
PS C:\Users\lmc $E = New-Object -ComObject Excel.Application
PS C:\Users\lmc $workbook = $E.Workbooks.Open("C:\dii\spreadsheet2.xlsm")
PS C:\Users\lmc $workbook.RunAutoMacros 1
This enables your xlsm to do all the work just by opening it; - runs your
macro, saves itself, shuts down Excel.
Note: If you put the code in the Workbook_Open event in the ThisWorkbook
component you can skip the 3rd line of code in C++ app.
Optionally, your "testmacro" can save and quit as well so all you need to do is
Free usenet access at http://www.eternal-september.org