Search code examples
c#indexingexehresult

Exe file Error HResult 0x8002000B, Invalid Index


Possible Duplicate:
How to run a C# .exe file on many computers?

I have a problem with my executable file. I made in C# windows forms to convert from txt to excel. Then in debug i took exe file there. In my computer with .NET 40 and Excel 2010 i got no problem at all. But when i tried it in my another laptop it shows me Invalid Index HRESULT 0x8002000B. There is office 2010 but no visual studio 2010 . How can i fix it? Is the problem because there is no Visual Studio Installation, if so how can i make executable file with all library?


Solution

  • After research on internet and asking friends, now i know why i got this problem. I tried with setup but it doesn't work, give me same error with invalid index.

    The problem is with excel option, some users set up excel worksheetsnumber to 3, some to 1 ... By default is always 3. But if the user change it to 1 and in my C# i don't add new Worksheet but just get_item, so it will give me an error with invalid index. So i solve it with delete all worksheets in workbook in my C code, then add new Worksheets.

    Thanks you guys for helping me, if someone convert or export from excel to txt, pdf or something else, please remember that default is 3 worksheets, but the user can change it and you got Error 0x8002000B :)