J'ai déjà effectué une recherche sur le forum pour mon problème, mais sans réponse
J'utilise un code VBA sur Excel pour envoyer un mail via Thunderbird
Code : Tout sélectionner
Sub EnvoiThunderbird(LigClt As Long, LigDoc As Long, sObj As String)
Dim sAdrTo As String, Quoi As String, sBody As String, sNum As String
Dim sPathFile As String, StrCmd As String, sPathTB As String
' Récupérer l'adresse mail du client
sAdrTo = Sheets("CLIENT").Range("F" & LigClt)
' Récupérer les infos nécessaires
Quoi = Sheets("ListeDoc").Range("A" & LigDoc)
sNum = Sheets("ListeDoc").Range("B" & LigDoc)
sBody = "Bonjour," & "<br><br>" _
& "Vous trouverez ci-joint votre " & Quoi & IIf(Quoi = "DEVIS", " cité", " citée") _
& " en objet au format PDF." & "<br><br>" _
& "Vous en souhaitant bonne réception."
' Récupérer le chemin d'accès au fichier
sPathFile = Sheets("ListeDoc").Range("I" & LigDoc).Formula
sPathFile = Mid(sPathFile, 13)
sPathFile = Left(sPathFile, InStr(14, sPathFile, Chr(34)) - 1)
' Tester l'emplacement du programme
sPathTB = CheminValide("C:\Program Files (x86)\Mozilla Thunderbird\")
If sPathTB = "" Then CheminValide ("C:\Program Files\Mozilla Thunderbird\")
If sPathTB = "" Then
MsgBox "Impossible de trouver la messagerie Thinderbird !", vbCritical, "ARRET..."
Exit Sub
End If
' Préparer la chaine d'envoi via Thunderbird
StrCmd = sPathTB & "thunderbird"
StrCmd = StrCmd & " -compose " & "to='" & sAdrTo & "'"
StrCmd = StrCmd & "," & "subject=" & Quoi & " n° " & sNum & " - " & sObj & ","
StrCmd = StrCmd & "format='1',"
StrCmd = StrCmd & "body=" & sBody & ","
StrCmd = StrCmd & "attachment=file:///" & sPathFile
MsgBox StrCmd
Call Shell(StrCmd, vbNormalFocus)
End Sub
Qui pourrait m'aider SVP
Merci d'avance
Votre Navigateur : Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36