PC Review


Reply
Thread Tools Rate Thread

Close Excel server after activating OLE object

 
 
Goofball
Guest
Posts: n/a
 
      13th Mar 2008
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.
 
Reply With Quote
 
 
 
 
Goofball
Guest
Posts: n/a
 
      13th Mar 2008
On Mar 13, 6:05 pm, Goofball <yuriytk...@gmail.com> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activating object from Excel cell Amnon Wilensky Microsoft Excel Worksheet Functions 2 29th Mar 2009 06:46 PM
Close Excel server after activating OLE object Goofball Microsoft Excel Misc 1 13th Mar 2008 05:32 PM
Re: How to close excel object with C# Mary Chipman Microsoft ASP .NET 1 9th Apr 2004 06:24 PM
How to hide Excel window when activating a Shape object Yi Microsoft Excel Programming 4 8th Oct 2003 02:36 PM
Re: How to hide Excel window when activating a Shape object Bob Kilmer Microsoft Excel Programming 1 29th Sep 2003 01:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.