ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to add items to combobox (https://www.excelbanter.com/excel-programming/308323-how-add-items-combobox.html)

Marek

how to add items to combobox
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

how to add items to combobox
 
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)

"Marek " wrote in message
...
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 ?


thanks


---
Message posted from http://www.ExcelForum.com/




Marek

how to add items to combobox
 
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


:

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

how to add items to combobox
 
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)

"Marek " wrote in message
...
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


:(


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com