Solved

VSTO 0x800A03EC COM Exception

Posted on 2010-09-16
6
1,143 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
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
UsamaFoad earned 500 total points
Comment Utility
0
 

Author Comment

by:thomehm
Comment Utility
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 35

Expert Comment

by:Miguel Oz
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:thomehm
Comment Utility
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 35

Expert Comment

by:Miguel Oz
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

My experience with Windows 10 over a one year period and suggestions for smooth operation
Outlook Free & Paid Tools
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now