Excel VSTO: Faulty call at run-time RRS feed

  • Question

  • I have a weird error, which I have no idea of what causes it.

    Basically I have public sub calling a public sub in my Ribbon code. Call goes fine, the sub called completes without throwing an exception, but as soon as I get back to the calling sub, I get an error. It returns nothing (since it's a sub), it doesn't give any error when building or compiling and the error code is -2146827284.

    I guess I could also ask that how do I make a faulty call from a Sub to a Sub so that it is only discovered at run-time?

    Tuesday, January 14, 2014 5:02 PM

All replies

  • Hello KilpAr,

    Could you please be more specific? What sub do you call from your ribbon code?

    Tuesday, January 14, 2014 5:13 PM
  • Hello,

    -2146827284 stands for 0x800A03EC. It looks like Excel generates this HRESULT in numerous scenarios so you definitely need to be more specific about your code. But first, wrap your code in a try/catch block. This will allow you to find out the offending code line.

    Also, I'd recommend checking if any Excel collection is used as 0-based: all Excel collections are 1-based. And check if the same occurs if you operate on an active/visible sheet/workbook.

    See also and

    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    Wednesday, January 15, 2014 7:39 AM