Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
|
|||
|
|||
Close Excel server after activating OLE object
We have an application that processes multiple excel objects that
embedded into RTF. To process an object I need to active it in place, get the pointer to the workbook, call some functions and then close the workbook and object. I use the following code: LPOLEOBJECT object; // Getting pointer to the object ......... LPOLECLIENTSITE site; object-GetClientSite(&site); result = object-DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, site, 0, NULL, NULL); if (result == S_OK) { // Do actions... } object-Close(); site-Release(); object-Release(); In most cases everything works OK without any problems. But sometimes, we encounter very strange excel tables and when I call DoVerb, I get such result: 0x80010105 The server threw an exception. I don't really know the reason, why Excel server does not process the documents. More interesting, when I open an RTF document in Word and double click the embedded excel table, I get the error message, that the application cannot process object. OK, so maybe the object is corrupted. However, when I open the RTF in OpenOffice, I can double click on excel table and it will activate fine. We can live with the corrupted tables in our application. We just need to inform the user about that. And here I have such problem: Excel server throws an exception when calling DoVerb and it does not close after that. Excel server keeps hanging in the memory and does not open correctly non of the following excel tables in the document (even if they are not corrupted). So the question is: how to close the Excel server that didn't activated the document after calling DoVerb? I thought, maybe it is displaying some message boxes, but it is not in the UI state. The excel sheet (which I got, after opening it in the OpenOffice) has some formulas that reference other files that I don't have. Maybe Excel tries to recalculate formulas and thus hangs? I would appreciate any help. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
|
|||
|
|||
Close Excel server after activating OLE object
On Mar 13, 6:05 pm, Goofball wrote:
We have an application that processes multiple excel objects that embedded into RTF. To process an object I need to active it in place, get the pointer to the workbook, call some functions and then close the workbook and object. I use the following code: LPOLEOBJECT object; // Getting pointer to the object ........ LPOLECLIENTSITE site; object-GetClientSite(&site); result = object-DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, site, 0, NULL, NULL); if (result == S_OK) { // Do actions... } object-Close(); site-Release(); object-Release(); In most cases everything works OK without any problems. But sometimes, we encounter very strange excel tables and when I call DoVerb, I get such result: 0x80010105 The server threw an exception. I don't really know the reason, why Excel server does not process the documents. More interesting, when I open an RTF document in Word and double click the embedded excel table, I get the error message, that the application cannot process object. OK, so maybe the object is corrupted. However, when I open the RTF in OpenOffice, I can double click on excel table and it will activate fine. We can live with the corrupted tables in our application. We just need to inform the user about that. And here I have such problem: Excel server throws an exception when calling DoVerb and it does not close after that. Excel server keeps hanging in the memory and does not open correctly non of the following excel tables in the document (even if they are not corrupted). So the question is: how to close the Excel server that didn't activated the document after calling DoVerb? I thought, maybe it is displaying some message boxes, but it is not in the UI state. The excel sheet (which I got, after opening it in the OpenOffice) has some formulas that reference other files that I don't have. Maybe Excel tries to recalculate formulas and thus hangs? I would appreciate any help. Thanks in advance. Well, I've tried another thing. The following code starts the Excel application and then when object is activated it is activated in the started server. Then I call Quit. Excel::_ApplicationPtr appExcel1("Excel.Application"); appExcel1-AskToUpdateLinks[0] = VARIANT_FALSE; appExcel1-DisplayAlerts[0] = VARIANT_FALSE; appExcel1-DisplayInfoWindow = VARIANT_FALSE; appExcel1-EnableEvents = VARIANT_FALSE; LPOLECLIENTSITE site; object-GetClientSite(&site); result = object-DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, site, 0, NULL, NULL); appExcel1-Quit(); However, after Quit() is called, I get the standard Excel error that is saying that Excel has encountered a problem and needs to close. It asks to send an Error Report and so on. :) Sounds like the Excel table is really corrupted. Well, maybe somebody knows how to disable showing of that message and quietly Quit the application. That would help a lot. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Activating object from Excel cell | Excel Worksheet Functions | |||
Close Excel server after activating OLE object | Excel Discussion (Misc queries) | |||
Excel Server Object won't overwrite | Excel Worksheet Functions | |||
How to hide Excel window when activating a Shape object | Excel Programming | |||
How to hide Excel window when activating a Shape object | Excel Programming |