I am working on an addin for excel 2010 using C#. I have an existing worksheet that has some controls in it, namely a ComboBox. I am trying to write some code that will place a certain value in the combo box's text property, but I am having a hard time getting access to the control to do so.
The combo box is named 'ComboBox1' but if I try something like...
var combo = Controls["ComboBox1"];
I get an ArgumentOutOfRangeException.
Exploratory approaches to finding out what I am supposed to be doing aren't really providing useful information either. For example, if were to write;
MessageBox.Show(Controls[0].GetType())
The displayed message is 'NamedRangeImpl' which doesn't seem like a control at all. So my question is, how do I get access to the controls that are on my worksheet from my code?