I am getting HRESULT: 0x800A03EC on Worksheet.range method. Number of rows are more than 70K. Office 2007.
Code:
Microsoft.Office.Interop.Excel.Range neededRange
= currentWS.Range[cell.Cells[1, 1], cell.Cells[nRowCount, nColumnCount]];
Here my rowcount is more than 65530 . Breaks on this function. I have observed that it breaks only when row count goes more than 65530.
Looking at the various responses above, and drawing on my own recent experience (I got this error code doing something completely unrelated -- setting
Application.Calculation
) I conclude that the same error code is used to indicate multiple unrelated problems. So @Garreh you should probably be asking a new question (not that anyone will be able to help based on the error code alone). I've seen the same thing working with Word interop from C#, where the sameHRESULT
seems to be used for almost every kind of error. I've never found any satisfactory Microsoft documentation on what the codes might mean.I had the same error code when executing the following statement:
The reason was the missing semicolon (;) after "TEXT".
Here is the correct one:
This problem occurs if you are using a backwards compatible sheet (a .xls) instead of a .xlsx
To allow sheets to be opened in pre office 2007 version it can't contain more than 65k rows. You can check the number of rows in your sheet by using ctrl+arrowdown till you hit the bottom. If you try to get a range larger than that number of rows it will create an error
EDIT: THIS IS WAY BETTER!!! You don't need that old function, sorry. Just do as follows:
That should work like a charm. And for future reference, put the relevant code that you are using inside of your question. Don't make people ask for it in comments. I imagine that's why you got downvoted.
We were receiving the same. The exception was
with an inner exception of
We were able to resolve the problem with information from this post, which I quote here for convenience...
I had an error with exact code when I tried to assigned array of cells to range.Value. In my case it was the problem with wrong data format. The cell's data format was set as DATE but the user made an error and instead of "20.02.2013" entered date "20.02.0213". The Excel's COM object refused taking year '0213' and threw exception with this error.