Excel Automation - orphan instance

B

Baxter

Using KB # 308407 and 307473 in Visual C++ 2003, on Win2000

1. I make the header files for the Excel Type Library as described in KB #
307473 - for the Excel interfaces as described in KB # 308407 (_Application,
_Workbook, etc.)
2. Put following line in header:
CApplication m_appExcel;

3. put following code in .cpp file:

bool CMyClass::RunExcel()
{
COleException oleError;
if (!m_appExcel.CreateDispatch("Excel.Application", &oleError)) {
oleError.ReportError();
return false;
}
m_appExcel.Quit();
return true;
}

4. Run code ( myclass.RunExcel(); )
5. This leaves an Excel.exe _process_ running in the Task Manager (but not
as an application.)

How do I prevent this orphan process? It screws up double-clicking on a
..xls file from Explorer.
 

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