12/01/2020, 08:23
Private Sub CommandButton1_Click()
Dim cCont As Control
Dim strControl As String
If ComboBox1.ListIndex > -1 Then
strControl = "Forms." & ComboBox1 & ".1"
End If
Set cCont = Me.Controls.Add _
(strControl, "CopyOf")
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "CheckBox"
.AddItem "CommandButton"
.AddItem "TextBox"
.AddItem "ToggleButton"
End With
End Sub
Dim cCont As Control
Dim strControl As String
If ComboBox1.ListIndex > -1 Then
strControl = "Forms." & ComboBox1 & ".1"
End If
Set cCont = Me.Controls.Add _
(strControl, "CopyOf")
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "CheckBox"
.AddItem "CommandButton"
.AddItem "TextBox"
.AddItem "ToggleButton"
End With
End Sub