Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to add an item to an activeX combobox that is located on a
worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim cbo As msforms.ComboBox Dim i As Long ReDim arr(0 To 5 - 1) As String For i = 1 To UBound(arr) + 1 arr(i - 1) = CStr(i * 11) Next ' could reference like this Set cbo = Worksheets("Sheet1").ComboBox1 ' but this gives more flexibility Set cbo = Worksheets("Sheet1").OLEObjects("ComboBox1").Objec t 'assign entire array (replacing existing) cbo.List = arr ' add a new 3rd item (1st item is index-0) cbo.AddItem "abc", 2 ' add an item at the end cbo.AddItem "xyz" End Sub Regards, Peter T "Daniel Jones" wrote in message ... I want to add an item to an activeX combobox that is located on a worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sheets("Sheet1").ComboBox1.AddItem ("Item1")
-- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 27, 5:18*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote: Sheets("Sheet1").ComboBox1.AddItem ("Item1") -- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. *Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? *I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! This is awesome - thanks guys! How would I go about deleting all of the items in the combo box? I figured out how to delete one at a time but couldn't figure out how to delete all. Thanks! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks! How would I go about deleting all of the items in the
combobox? I could only discover how to delete one at a time like so Worksheets("Sheet1").ComboBox1.RemoveItem (0) On Aug 27, 5:18*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: Sheets("Sheet1").ComboBox1.AddItem ("Item1") -- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. *Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? *I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this...
Worksheets("Sheet1").ComboBox1.Clear -- Rick (MVP - Excel) "Daniel Jones" wrote in message ... Thanks! How would I go about deleting all of the items in the combobox? I could only discover how to delete one at a time like so Worksheets("Sheet1").ComboBox1.RemoveItem (0) On Aug 27, 5:18 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: Sheets("Sheet1").ComboBox1.AddItem ("Item1") -- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 28, 12:19*am, "Rick Rothstein"
wrote: Try this... Worksheets("Sheet1").ComboBox1.Clear -- Rick (MVP - Excel) "Daniel Jones" wrote in message ... Thanks! How would I go about deleting all of the items in the combobox? I could only discover how to delete one at a time like so Worksheets("Sheet1").ComboBox1.RemoveItem (0) On Aug 27, 5:18 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: Sheets("Sheet1").ComboBox1.AddItem ("Item1") -- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! Thanks! is this supposed to work with an activex combo box (from control toolbox)? in the help file it says "This method will fail if it's applied to a built-in command bar control." |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks! is this supposed to work with an activex combo
box (from control toolbox)? in the help file it says "This method will fail if it's applied to a built-in command bar control." You could always try any suggestions given to you on a newsgroup... that is usually faster than posting a question and waiting for an answer. Yes, this code works on a ComboBox from the Control Toolbox toolbar. -- Rick (MVP - Excel) "Daniel Jones" wrote in message ... On Aug 28, 12:19 am, "Rick Rothstein" wrote: Try this... Worksheets("Sheet1").ComboBox1.Clear -- Rick (MVP - Excel) "Daniel Jones" wrote in message ... Thanks! How would I go about deleting all of the items in the combobox? I could only discover how to delete one at a time like so Worksheets("Sheet1").ComboBox1.RemoveItem (0) On Aug 27, 5:18 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: Sheets("Sheet1").ComboBox1.AddItem ("Item1") -- HTH... Jim Thomlinson "Daniel Jones" wrote: I want to add an item to an activeX combobox that is located on a worksheet. Note this is not the combbox from the forms toolbar, and its not the combobox inside of userforms, its the control toolbox combobox. I'm getting an object doesn't support this property error when I try the following: Sub PopulateList() Worksheets("Sheet1").ComboBox1.Items.Add ("Item1") End Sub How do I add an item to this combobox? I don't want to use the ListFillRange property b/c I will be putting this inside of a loop. Thanks in advance! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
publish activeX combobox and other activeX control | Excel Programming | |||
How to display the first Item in a combobox as the default item | Excel Programming | |||
How to display the first Item in a combobox as the default item | Excel Programming | |||
ActiveX Control Item Numbers | Excel Programming | |||
ActiveX / C++ - Extra menu item | Excel Programming |