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
|
Sub envoi()
Dim cel As Range, fc As String, admail As String
Dim responsable As String, messmail As String, sujet As String
responsable = "Toto"
sujet = "BGTA"
'ci-dessous une feuille "adresses"
For Each cel In Sheets("adresses").Range("A1:a2") 'si les données (adresses mail et fichier à envoyer) sont en A et B
admail = cel.Value
fc = cel(1, 2).Value 'attention mettre chemin complet du fichier à envoyer
messmail = "Bonjour" & Chr(10) & "Ci-joint, le fichier" & Chr(10) & Chr(10) & responsable
strcommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird"
strcommand = strcommand & " -compose " & "to='" & admail & "'"
strcommand = strcommand & "," & "subject=" & sujet & ","
strcommand = strcommand & "body=" & messmail
strcommand = strcommand & "," & "attachment=" & fc
MsgBox strcommand
Call Shell(strcommand, vbNormalFocus)
Next cel
End Sub |
Partager