Disons que pour le sujet et le corps du message, il est plus simple de les prendre sur la même ligne que l'adresse mail. Sinon, pour la pièce jointe :
Public Function SendThunderbird(Desti As String, sujet As String, Corps As String, Optional PJ As String)
'This function can be used to send an e-mail from Mozilla Thunderbird.
'The syntax for calling Thunderbird from a command line (DOS prompt) is:
'
'thunderbird -compose "mailto:somebody@somewhere?cc=address@provider&subject=hi&body=something"
'
Dim strCommand As String
strCommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"
strCommand = strCommand & " -compose " & "to='" & Desti & "'"
strCommand = strCommand & "," & "subject=" & sujet & ","
strCommand = strCommand & "body=" & Corps
strCommand = strCommand & "," & "attachment=file:///" & PJ
Call Shell(strCommand, vbNormalFocus)
Application.Wait (Now + TimeValue("0:00:03"))
SendKeys "^{ENTER}", True
End Function
Sub test()
Dim C As Range
For Each C In Range("A2", Cells(Rows.Count, 1).End(xlUp))
If C.Offset(, 4) <> "" Then
SendThunderbird C.Offset(, 3).Value, C.Offset(, 8).Value, C.Offset(, 9).Value, C.Offset(, 4).Value
Else
SendThunderbird C.Offset(, 3).Value, C.Offset(, 8).Value, C.Offset(, 9).Value
End If
C.Offset(, 7) = Date
Next C
End Sub
Sinon, fais attention à la ligne :
strCommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"
et modifie le chemin au besoin.
Daniel