tags:

views:

21

answers:

1

I have an application which opens,reads and creates Excel files. The app has been written in C#. The error named in the title does not always show up, sometimes it is working as intended.

May be someone can point me to the cause of the error. Googling did not make me smarter on this one. By the way, is there some kind of overview of HRESULT codes for Excel interop?

Thanks a lot

A: 

I've had this happen a few times when working with Excel Interop. Most of the time it turned out to be me looking for something that wasn't in the excel sheet (IE: looking for a specific worksheet by name, trying to get something that wasn't within the current range).

You can try double checking the range that you are looking for and (if manually going over the range) you can check to make sure all of your indexes are within the bounds for the range.

Without some code, particularly where the error occurs, it will be hard to help you pinpoint the problem.

Tony Abrams
Most likely the latter problem, as referencing a sheet that does not exist would throw an "Invalid Index" error (HRESULT 0x800200B I believe)
MikeAbyss
I was speaking about the HRESULT errors in general :P
Tony Abrams
Well, thanks for the hints so far. I tried several things to access fields, workbooks etc. that are not there. It seems the error itself is not generated from excel but more likely from a MSFlexGrid using that Excel data (do not ask why the hell MSFlexGrid is used).I think I have to do some more research on this. Anyway...thanks again.
Sebastian