Sub InsertComboBox ()
Dim ole As OLEObject
Dim CTL boBox As MSForms.Com
Sheet2. Select
Cells (3, 5). Select
'insert combo box
The Set ole=Sheet2. OLEObjects. Add (ClassType:="Forms.Com boBox. 1")
Named
'
Ole. Name="Combo"
Set CTL.=ole Object
CTL. Name="Combo"
CTL. AddItem "Item1
"
CTL. AddItem "Item2"
CTL. AddItem "Item3
"
CTL. ListIndex=0 'first project ListIndex is 0
'add a Click event, is omitted
End Sub
CodePudding user response:
Try:Sheet2. OLEObjects. Add ClassType:="Forms.Com boBox. 1
"The Set ole=Sheet2. OLEObjects (" ComboBox1)
CodePudding user response:
Dim ole As OLEObjectDim CTL boBox As MSForms.Com
Write in function?