Ashim Mishra
Guest
|
Hi Team,
I want to know if there are any provision to check if excel is busy. I have been getting COMException while doing ExcelApp.Calculate most of the time. If there are any ways to check if Excel is busy then i can add that condition in that code block.
I know in COM we have IMessageFilter interface by implementing it, gives the RetryRejected way to make the COM call again. Is there something similar we can do with addinexpress ? It would be great if you can share some code example for the same. |
|
Andrei Smolin
Add-in Express team
Posts: 18825
Joined: 2006-05-11
|
Hello Ashim,
I suppose you get that exception because you perform COM calls in a thread other than the main one. Can this be the case? For instance, changing Ribbon controls is possible on the main thread only because internally, such a call invokes the IRibbonUI COM interface from the Office object model.
Ashim Mishra writes:
in COM we have IMessageFilter interface by implementing it, gives the RetryRejected way to make the COM call again
Although this is possible in theory, I've never seen this implemented in a VB/C# add-in.
Add-in Express doesn't provide such a way either. How could it provide such a way? We recommend using this approach: all COM calls should be performed on the main thread.
Andrei Smolin
Add-in Express Team Leader |
|
Ashim Mishra
Guest
|
Hi Andrei,
We always make COM calls using the SendMessage mechanism, which i believe ensure that the interaction is happening on Main thread, isn't it ? Despite that it's throwing COMException.
Any thing else you can suggest to mitigate this issue ? |
|
Andrei Smolin
Add-in Express team
Posts: 18825
Joined: 2006-05-11
|
|