How to clear Excel ActiveX ComboBox list with VBA. I expected this code would work:
Sheet1.OLEObjects(1).Clear
but it raises
runtime error object doesn't support this property or method.
I am puzzled because this works:
Sheet1.OLEObjects(1).Name
returning the name TempCombo.
I still fail when I try this:
Sheet1.TempCombo.Clear
It returns error:
Runtime error Unspecified error.
What else should I check?
Sheet1.OLEObjects(1).Object.Clear. But alsoSheet1.TempCombo.Clearworks for me without throwing an error.Sheet1.TempCombo.List = Array()is another way to remove all items from the list. • I cannot reproduce your issue. There must be something else causing this error. - PᴇʜSheet1.OLEObjects(1).Namewould not give the correct name. Therefore also the ComboBox name is proof. - PᴇʜSheet1.TempCombo.Clearwill fail unless the property.ListFillRange = "". This is experienced by other users stackoverflow.com/a/51425477/1903793 - Przemyslaw Remin.ListFillRangein my test. I added items withTempCombo.AddItem "test". So thanks for the follow up. - Pᴇʜ