COMException with interopServices C# in Excel only with xlsx. RRS feed

  • Question

  • Getting exception

    {System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC}

    while adding the validation on xlsx columns.

    Code line causing the exception:

    xlWorkSheet.get_Range("E:E", misValue).Validation.Add(Excel.XlDVType.xlValidateCustom, Type.Missing, Type.Missing, "\"\"");

    Above code works fine with .xlx but fails with .xlsx.

    Wednesday, March 13, 2019 9:06 AM

All replies

  • Hello,

    The error code 0x800A03EC (or -2146827284) means NAME_NOT_FOUND; in other words, you've asked for something, and Excel can't find it.

    Try to specify the definitive range in the code:

    xlWorkSheet.get_Range("E1", "E2")

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, March 18, 2019 9:33 AM