D
Donkeylung
I have a basic MFC Excel Automation Issue. I create the Dispatch, but
Excel only "blinks" open, but it does not remain that way.
I get the excel object of an MFC Type Library.
I have
if(!AfxOleInit()) // Your addition starts here
{
AfxMessageBox("Could not initialize COM dll");
return FALSE;
}
in the InitInstance() function.
and
CApplication1 oExcel;//Generated _Application object
if(!oExcel.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Could not start Excel.");
}
oExcel.put_Visible(TRUE);
oExcel.ReleaseDispatch();
in the event handler.
When I did the same thing in Word (with its own _Application object and
"Word.Application" in CreateDispatch) , it opens with no problems, but
the Excel will not stay open.
Any Suggestions? This seems so basic. What am I doing wrong.
Thanks
Excel only "blinks" open, but it does not remain that way.
I get the excel object of an MFC Type Library.
I have
if(!AfxOleInit()) // Your addition starts here
{
AfxMessageBox("Could not initialize COM dll");
return FALSE;
}
in the InitInstance() function.
and
CApplication1 oExcel;//Generated _Application object
if(!oExcel.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Could not start Excel.");
}
oExcel.put_Visible(TRUE);
oExcel.ReleaseDispatch();
in the event handler.
When I did the same thing in Word (with its own _Application object and
"Word.Application" in CreateDispatch) , it opens with no problems, but
the Excel will not stay open.
Any Suggestions? This seems so basic. What am I doing wrong.
Thanks