C# excel add-in create drop down list throws Exception from HRESULT: 0x800A03EC RRS feed

  • Question

  • Hi 

    I'm new to developing excel add-on.

    I'm trying to add a drop down list to a cell, this is what i have done so far

      Range ddlRng = worksheetname.Range[
                        worksheetname.Cells[firstRow, Column],
                        worksheetname.Cells[lastRow, Column]];
                    ddlRng.Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertStop, XlFormatConditionOperator.xlBetween, "Opt1,Opt2,Opt3", Missing.Value);

    at validation.add() line it throws an exception saying "Exception from HRESULT: 0x800A03EC"

    and this is the StackTrace 

    "   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)\r\n   at Microsoft.Office.Interop.Excel.Validation.Add(XlDVType Type, Object AlertStyle, Object Operator, Object Formula1, Object Formula2)\r\n   at MS.ProductionPlanningTool.Excel.CommonPack.ControllerServiceClass.AddMaterialVersionList() in D:\\MidasCloud\\CloudTFS\\ProductionPlanning\\MSP2\\MS.ProductionPlanningTool.Excel\\CommonPack\\ControllerServiceClass.cs:line 1892"

    Thursday, July 27, 2017 9:39 AM