I am working with Window Service project. that have to write data to a sheet in Excel file in a sequence times.
But sometimes, just sometimes, the service throw out
I ran to a similar error running Excel in VBA, what I've learned is that when I pull data from MSSQL, and then using get_range
and .Value2
apply it's out of the range, any value that was of type uniqueidentifier
(GUID) resulted in this error.
Only when I cast the value to nvarcahr(max)
it worked.
The error code 0x800A03EC
(or -2146827284) means NAME_NOT_FOUND; in other words, you've asked for something, and Excel can't find it.
This is a generic code, which can apply to lots of things it can't find e.g. using properties which aren't valid at that time like PivotItem.SourceNameStandard
throws this when a PivotItem doesn't have a filter applied. Worksheets["BLAHBLAH"]
throws this, when the sheet doesn't exist etc. In general, you are asking for something with a specific name and it doesn't exist. As for why, that will taking some digging on your part.
Check your sheet definitely does have the Range you are asking for, or that the .CellName
is definitely giving back the name of the range you are asking for.
I got the error with a space in a Sheet Name:
using (var range = _excelApp.Range["Sheet Name Had Space!$A$1"].WithComCleanup())
I fixed it by putting single quotes around Sheet Names with spaces:
using (var range = _excelApp.Range["'Sheet Name Had Space'!$A$1"].WithComCleanup())
The meaning of the completely undocumented error 800A03EC (shame on Microsoft!) is something like "OPERATION NOT SUPPORTED".
It may happen
But mostly you will see this error due to severe bugs in Excel.
Application.Visible=true
and Application.WindowState = XlWindowState.xlMinimized
then you will get hundreds of 800A03EC errors from different functions (like Range.Merge(), CheckBox.Text, Shape.TopLeftCell, Shape.Locked and many more). This bug does not exist in Excel 2007 and 2010.Interesting enough, this error also occurs, at time of opening when the .XLS?
file is incorrectly formed or require repairs.
A hard to find error is to many rows on a .xls (old excel) file.
Test it: manually open the affected file with excel desktop .
I use automation to process a few hundred files daily, when this error show up, I notify the owner via mail and save the unprocessed file on a temporary location.
I have encountered this error code when enumerating names and calling worksheet.get_Range(name). It seems to occur when the name does NOT apply to a range, in my case it is the name of a macro.