I am working on an add-on for excel 2010 using C #. I have a worksheet that has some controls, namely a ComboBox. I am trying to write code that will put a specific value in a property of a text field, but it is difficult for me to access the control to do this.
The combo box is called "ComboBox1", but if I try something like ...
var combo = Controls["ComboBox1"];
I get an ArgumentOutOfRangeException exception.
Research approaches to figuring out what I should do also do not provide useful information. For example, if you were to write:
MessageBox.Show(Controls[0].GetType())
The displayed message is "NamedRangeImpl", which does not look like a control at all. So my question is: how do I access the controls that are on my worksheet from my code?
source share