1

I am trying to code a macro (I don't know if this name exists in english, but whatever) for Excel, and when I run it, I have this error that shows up :

check the ErrorCode property of the exception to determine the HRESULT returned by the COM object

With the additionnal information : Exception of HRESULT : 0x800A03EC

And I really don't know how to resolve this... I have tried a lot of answers from different forums, but nothing worked so far :(

Here is the part of my code where I get the error : (I will not paste everything as it is far too long)

if (PPE_ExcelFiles.dataWorksheet.get_Range(NOFEUIL_Column + noRowDataFile) != null) {...}

PPE_ExcelFiles being another public Class I have made, and dataWorkSheet is of the type Excel.Worksheet. (And the type of what is inside the cell should be a string).

I have tried some other things, like :

string str = (string)PPE_ExcelFiles.dataWorksheet.get_Range(NOFEUIL_Column + noRowDataFile).Value;
    if (str != null) {...}

And it didn't work either, receiving the same error, on the first line.

I don't know what kind of other informations you would potentially need to help me, as I really don't know what goes wrong, so tell me if there are some !

Thank you a lot

EDIT :

In the possible duplicate post, they say that it can occur if Excel can't find what we're asking it to. But that should not be the case for me :

  • noRowDataFile = 2
  • NOFEUIL_Column = "G"
  • PPE_ExcelFiles.dataworksheet exists
  • the sheet has a value in [G,2]
  • .get_Range(string + int) works wonders in another code
Sanimys
  • 101
  • 1
  • 10
  • 1
    Possible duplicate of [Excel error HRESULT: 0x800A03EC while trying to get range with cell's name](https://stackoverflow.com/questions/891394/excel-error-hresult-0x800a03ec-while-trying-to-get-range-with-cells-name) – Icepickle Jul 06 '17 at 12:13
  • 1
    The duplicate I found was the 4th result in google or something, so I am unsure what you looked for in the other forums, it also has an accepted answer. If it doesn't find, please explain in your post what is different between your question and the other question – Icepickle Jul 06 '17 at 12:15
  • @Icepickle I didn't see this post, thanks ! The answer they give is interesting, but at first sight the problem they tell about should not be hapenning.. I will investigate a bit – Sanimys Jul 06 '17 at 12:23
  • @Icepickle the "duplicate" doesn't work for me and I have edited my post :) (I don't know if my edit sends you a notification) – Sanimys Jul 06 '17 at 12:55
  • 1
    No, but the @ notifications I got :) You could try the [search field here](https://stackoverflow.com/search?q=0x800A03EC), there are quite some posts reporting this error, and with the limited data available, I guess you would need to fine tune what the problem might be – Icepickle Jul 06 '17 at 13:20

1 Answers1

0

Okay I think that I found the error, the value inside the range is a double type and it couldn't convert from double to string obviously...

Well in the end it was really easy, so many hours of debugging for that ! x')

Sanimys
  • 101
  • 1
  • 10