Solved

VSTO 0x800A03EC COM Exception

Posted on 2010-09-16
6
1,166 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 500 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
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

690 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