Code generated ComboBox (ActiveX)
Manually add a combobox to Activesheet and right click to see its properties.
Next, run the following code to add a combobox through code and right click - you won't be able to see the properties now.
Right click on the code-generated control and choose Group->Ungroup as many times to ungroup the control and it is ungrouped into multiple shapes.
Conclusion: The controls added through code are different from the ones manually added.
Sub TestCode() Dim abc As OLEObject Set abc = ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False, _ DisplayAsIcon:=False, Left:=312.75, Top:=99.75, Width:=188.25, Height _ :=24.75) 'If you right click on the combobox thus created you won't be able to view its properties 'as against the one manually added. abc.Object.AddItem "A" 'abc.Object.ListFillRange = "A1:A2" 'This doesn't work Set abc = Nothing End Sub
»
- Vishesh's blog
- Login or register to post comments
- 7001 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago