Bonjour le forum,
J'utilise un code afin d'envoyer un mail via thunderbird :
Sub MailThunderbird()
Dim ligne As Long
Dim destinataire, sujet, fichierjoint As String, cc As String
ligne = Selection.Row
destinataire = Range("I" & ligne) & ";" & Range("AE2")
sujet = "Pièce jointe " & "blabla " & Range("B" & ligne)
fichierjoint = Application.GetOpenFilename("Tous les fichiers(*.*),.pdf")
Text1 = "Bonjour," & "<br><br>"
Text2 = "blablabla:" & "<br><br>"
Text3 = "<b>Identifiant : " & Range("B" & ligne) & " : " & ActiveSheet.Name & " : " & Range("C" & ligne) & "</b>" & "<br>"
text4 = "<b>Numéro : " & Range("D" & ligne) & " : " & Range("E" & ligne) & "</b>" & "<br>"
text5 = "<b>Date(s) : " & Range("H" & ligne) & "</b>" & "<br><br>"
text6 = "blablabla" & "<br><br>"
text7 = "blabla," & "<br><br>"
Range("J" & ligne).FormulaLocal = Date
Body = Text1 & Text2 & Text3 & text4 & text5 & text6 & text7
strcommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"
strcommand = strcommand & " -compose " & "to='" & destinataire & "'"
strcommand = strcommand & "," & "subject=" & sujet & sujet1 & ","
strcommand = strcommand & "body='" & Body & "'"
strcommand = strcommand & "," & "attachment=file:///" & fichierjoint
Call Shell(strcommand, vbNormalFocus)
End Sub
Comme je suis un peu tête en l'air et qu'il m'arrive d'oublier les pièces jointes, ce code me permet de sélectionner un fichier avant même d'avoir l'aperçu du mail.
En revanche, tout dépend où je vais chercher ma pièce jointe. Si c'est sur le bureau, RAS. Si je dois aller la chercher un peu plus loin, dans le dossier d'un dossier d'un dossier, ça bloque et j'ai le message d'erreur suivant : Le fichier file:///C:\Users\s5\Documents\2016\ECO\700\09112016\em 09112016 n'existe pas et n'a pu être joint au message.
Auriez-vous une solution à m'apporter ?
Merci par avance, et bon lundi