Solved

VSTO 0x800A03EC COM Exception

Posted on 2010-09-16
6
1,162 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 IT Pros

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

734 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