I\'m trying to add a formula to cell but i got the error Exception from HRESULT: 0x800A03EC There are lots of posts with similar issues however none could help
in my case I was missing double-quotes in the HYPERLINK formula arguments, i.e. the formula itself was wrong. i tried a valid formula, like ..Cell(x,y).Formula = "=MIN(2)" and it worked, therefore that was the case..
Perhaps this brings you into the right direction->
[a link] (http://www.codeproject.com/Questions/470089/Exception-from-HRESULT-0x800A03EC-Error)
Hans Passant is correct, but there may be additional settings needed to enable Excel's ability to handle the cadence of your code operations.
Here's a good set of options to make Excel capable of processing requests faster: Turn Automatic Calculations Off/On
A summary of what worked for me:
using Excel = Microsoft.Office.Interop.Excel;
public class ExcelAppWrapper : IDisposable
{
private Excel.Application _application;
public ExcelAppWrapper()
{
_application = new Excel.Application { Visible = true };
_application.Workbooks.Add(Missing.Value);
//there must be a workbook before setting Application.Calculation
ConfigureApplication(false);
}
public void Dispose()
{
ConfigureApplication(true);
}
private void ConfigureApplication(bool enable)
{
_application.Calculation = enable ? XlCalculation.xlCalculationAutomatic : XlCalculation.xlCalculationManual;
_application.EnableEvents = enable;
_application.ScreenUpdating = enable;
_application.DisplayStatusBar = enable;
}
}
It is a crappy exception and doesn't mean anything more than you slamming Excel with processing requests at a rate that it cannot keep up with. Your program essentially looks like a hyper-active user that's entering formulas at a rate of one per microsecond.
The workaround is to go slower by intentionally sleeping or to force Excel to do less work. You will very probably fix it in this case by assigning the Application.Calculation property. Set it to manual before you start putting formulas into cells. And back to auto after you're done.
More good advice in this blog post.