1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Private Sub TextBox1_AfterUpdate()' ou évènement exit, à voir
Dim es, x As Integer, ch As String, lg As Integer, y As Integer, result(), z As Integer
Dim lgcar As Integer
lg = 15 'suivant la longueur choisie pour tes lignes
es = Split(UserForm1.TextBox1, " ")
ReDim Preserve result(x)
y = UBound(es)
z = 1
ch = ""
result(x) = es(0)
ch = es(0)
lgcar = 0
For x = 0 To y
ReDim Preserve result(x)
While Len(result(x)) < lg + 1 And z <= UBound(es)
ch = ch & " " & es(z)
result(x) = ch
z = z + 1
Wend
ch = ""
If z > UBound(es) Then Exit For
Next x
TextBox1.Text = result(0)
For x = 1 To UBound(result)
TextBox1 = TextBox1 & Chr(10) & result(x)
Next x
End Sub |
Partager