1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub CommandButton1_Click()
txt = ""
ctr = 0
tabl = Split(Me.TextBox1.Text, " ")
For i = 0 To UBound(tabl)
If ctr > 80 Then
ctr = Len(tabl(i)) + 1
txt = txt & vbCrLf & tabl(i) & " "
Else
ctr = ctr + Len(tabl(i)) + 1
txt = txt & tabl(i) & " "
End If
Next i
Set olApp = CreateObject("Outlook.application")
Set m = olApp.CreateItem(olMailItem)
With m
.Subject = "Subject"
.Body = txt
.Recipients.Add "test@test.com"
.display
End With
Set olApp = Nothing
tabl = Split(txt, Chr(10))
End Sub |
Partager