Excel Interop Dropdownlist events

658 Views Asked by At

I am able to add a dropdown list to a cell in Excel and populate it from an array like so:

        Range oRange = ws.get_Range("A1", "A1");
        DropDowns xlDropDowns;
        DropDown xlDropDown;
        xlDropDowns = ((DropDowns)(ws.DropDowns(Type.Missing)));
        xlDropDown = xlDropDowns.Add((double)oRange.Left, (double)oRange.Top, (double)oRange.Width, (double)oRange.Height, true);

        string[] items = new string[] { "John", "Jim", "Jason", "Joe" };

        //Add items into drop down list
        for (int i = 0; i < items.Length; i++)
        {
            xlDropDown.AddItem(items[i], i + 1);
        }

But I am not able to see how a change/selectchange event can be associated to this dropdown and how it functions (does it go back to c# code or somewhere else) documentation seems limited. There is onAction but cant find examples on how to use that. Thanks

0

There are 0 best solutions below