Hi dizo and welcome to the forum.
I'm not an excel expert but maybe I can give you some more help with
Excel 2007 OleObjects
than you got when you posted elsewhere,
here and
here.
A quick search found this
offsite thread
that indicates a possible solution might be something like:
Code:
xlcombobox.Object.AddItem "SomeData"
..or using the code offered by someone name "XL-Dennis" in
this social.msdn forum thread the other way might be:
Code:
With xlcombobox.Object
.Additem("VSTO")
.Additem("Excel")
.Additem("Dennis")
.LinkedCell = "B1"
End With
...or
this oxgrid thread indicates you can also use a do..while loop to populate
with values from a array holding database data.
If I substitute you combobox name,
the code would look something like:
Code:
Do While Loopcntr <= TaskListArraySizeHolder
DDholdName = TaskListArray(Loopcntr)
xlcombobox.Object.AddItem DDholdName
Loopcntr = Loopcntr + 1
Loop
Also, I don't know if it will fit with what you are doing, but I've seen
some Excel code that uses shape objects to dynamically create dropdowns
as comboboxes and populate them.
This MrExcel forum thread has some example code for that approach:
Code:
With Worksheets(1)
Set lb = .Shapes.AddFormControl(xlDropDown, 10, 10, 100, 16)
lb.ControlFormat.AddItem "one",1
lb.ControlFormat.AddItem "two",2
End With
If you are wondering what the ControlFormat.AddItem parameters refer to, please see
this MSDN page.
For the parameters info of the .Shape.AddFormatControl method in Excel 2007, please see
this MSDN page.