?
Solved

VSTO 0x800A03EC COM Exception

Posted on 2010-09-16
6
Medium Priority
?
1,171 Views
Last Modified: 2012-05-10
I have a Windows Forms application which talks to Microsoft Excel via Visual Studio Tools for Office.  In this application, having previously set (VSTO) Application.Calculation to XlCalculation.xlCalculationManual without Except, my application then sets Application.Calculation back to XlCalculation.xlCalculationAutomatic.  At this point, the application gets a System.Runtime.InteropServices.COMException of 0x800A03EC.  Before I can solve this problem, I would at least like to first find out what this error means.  It seems to be a generic Excel COM exception.  But after much googleing, I haven’t been able to find even a simple description of what the error actually says.
Any advise on how I could proceed?
0
Comment
Question by:thomehm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
UsamaFoad earned 2000 total points
ID: 33699445
0
 

Author Comment

by:thomehm
ID: 33702227
Thanks UsamaFoad, at least now I know what the error means. Now I need to figure out what is causing my error.  The reference to social.msdn.com is interesting.  But it is mostly about how to set the Excel calculation to manual mode.  This  I already know how to do.  And it almost always works.  But I do get this error under certain test conditions.  Now I need to get a better definition of what those conditions are.
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 33714047
Some clarifications from you:
1) Is your excel file read only?
2) Please provide code snippet where the call  to XlCalculation.xlCalculationAutomatic is done. Is it done on the main VSTO thread?
3) Are you targeting Office 2003 or 2007? What VS version are you using?
Note: Please change one of the zones to VSTO zone. (http://www.experts-exchange.com/Microsoft/Development/VSTO/)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:thomehm
ID: 33717156
The excel file is not read only.  The target is Office 2007, using VS 2008.  I'm not sure what thread this is in.  The call to set the XlCalculation.xlCalculationAutomatic is in the context of a menu item click event.  Is there are requirement that the call to Excel VSTO happen in the same thread as it was started in?  Or more general question, could click events for the Windows Forms application occur in some thread that is unacceptable in the context of the VSTO Excel call?  Or even more general question, should I investigate this in terms or threading issues?  Is that a likely problem?  I do know that this code almost always runs without incident.  It is only in a certain environment and then only once in a while.  I might add that when I tested this on a couple of machines there was not issue.  The problem is only occurring when the application was tested by the IT department, running the test in a Virtual Machine.
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 33721152
Is there are requirement that the call to Excel VSTO happen in the same thread as it was started in?
>> Yes, it is a good VSTO design practice to keep the interop code (which is COM single threaded) within the VSTO main thread only.
  Or more general question, could click events for the Windows Forms application occur in some thread that is unacceptable in the context of the VSTO Excel call?
>> It depends, if your Winform is created in the same VSTO main thread, then it should be OK. I built Add-ins before and what I tend to do is to use the winform as dialogs and then come back to the main VSTO thread to execute whatever action is required. Thus , I avoid any potential crossthreading issue.
0
 

Author Comment

by:thomehm
ID: 33746819
Might I ask what I need to do to make sure that all of my VSTO calls are with the main VSTO thread?  I know how to do that with the regard to Windows Forms access to a control.  In that case I use the InvokeRequired and Invoke calls.  But I do not understand how I need to do this for VSTO calls.  Any help would be appreciated.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question