We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Cells oleobject value update

I have one excel and in that it contain activex combobox object (oleobject). Now what i need to do is that i want to set the value of dropdown.

I’m using .net technology. Please tell me how it is possible. I tried searching on net but could not find any solutions.

Any help will be appreciated.


Thanks for considering Aspose APIs.

Please see the following sample code, its source and output Excel files as well as the screenshot for a reference.

Download Links:
source and output Excel files.zip (19.8 KB)
sc.png (53.5 KB)


//Open your sample Excel file
Workbook wb = new Workbook("sample.xlsx");

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Access combo box, change its fill range and value property
Aspose.Cells.Drawing.ActiveXControls.ComboBoxActiveXControl combo = ws.Shapes[0].ActiveXControl as Aspose.Cells.Drawing.ActiveXControls.ComboBoxActiveXControl;
combo.ListFillRange = "J1:J4";
combo.Value = "Apple";

//Save the output Excel file


First of all thanks for your reply.

In my excel there is a macro on combobox change event.
Can i call that macro from c# code?


Well, you may add/update VBA codes/macros via Aspose.Cells APIs but you cannot execute macros/vba codes. See the documents in the section for your complete reference on how to add/assign or modify vba codes and macros:

You have to open the file into MS Excel to call the macros/vba codes.

Thank you.