Pas d'envoi mail thunderbird avec macro
Bonjour,
En m'inspirant de ce que l'on trouve sur le forum j'ai fait une macro pour envoyer des mails avec une piece jointe (différente pour chaque destinataire).
Code:
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 |
Quand je le lance, la MSG box a bien ce qu'i faut, une fenetre thunderbird s'ouvre mais rien ne se passe. pas de destinataire, pas de message,.... enfin rien du tout.:(
Je séche et je ne sais pas d'ou vient le problème.
Merci de vos réponses