how to add items to combobox

M

Marek

people i cant add items to the combobox,

i have sheet.name = s1
and on the sheet i have control placed combobox,
combobox name is combo1


in vb editor i write this text

worksheets("s1").shapes.item("combo1").additem "test"

but vb gives me error like = cant find object ???


how to correctly work with sheet controls from vb ?


thank
 
B

Bob Phillips

activesheet.oleobjects("combo1").object.additem "test"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

Marek

here is my code

Sub Button2_Click()
ActiveSheet.OLEObjects("combo1").Object.AddItem "test"
End Sub

clicking button i get error

unable to get Oleobjects property of the worksheet


:
 
B

Bob Phillips

Marek,

I guess that you must have a forms combobox?

AFAIK there is no way to additem to a forms combo, you have to link to a
spreadsheet range, or change to a control toolbox combo.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top