Option Explicit
Dim Buttons() As New Classe1
Private Sub CommandButton1_Click()
Dim I, Obj, L As String, g, s, d, h, e, a, b, C, dd
If TextBox1 = "" Then Exit Sub
Chaine = TextBox1
Tbl = Split(TextBox1, " ")
TblEnleve = Tbl
For I = 0 To UBound(TblEnleve)
TblEnleve(I) = ""
Next I
For I = 0 To UBound(Tbl)
L = Left(Tbl(I), 1)
Select Case L
Case "A"
a = a + 1
Set Obj = Me.Controls.Add("forms.CheckBox.1")
d = 40 'widht
h = 20 'height
s = 50 + h * a 'top
g = 30 'left
Case "B"
b = b + 1
Set Obj = Me.Controls.Add("forms.CheckBox.1")
d = 40 'widht
h = 20 'height
s = 50 + h * b 'top
g = 30 + d 'left
Case "C"
C = C + 1
Set Obj = Me.Controls.Add("forms.CheckBox.1")
d = 40 'widht
h = 20 'height
s = 50 + h * C 'top
g = 30 + d * 2 'left
Case "D"
dd = dd + 1
Set Obj = Me.Controls.Add("forms.CheckBox.1")
d = 40 'widht
h = 20 'height
s = 50 + h * dd 'top
g = 30 + d * 3 'left
End Select
With Obj
.Caption = Tbl(I)
.Left = g: .Top = s: .Width = d: .Height = h
End With
VBA.UserForms.Add (Me.Name)
Next
IniCheckbox
End Sub