Bonsoir le fil,
Tu peux poster le code VBA que tu utilises, stp?
(Normalement si tu utilisé celui du message#9 en ne changeant rien d'autre que l'adresse mail, ca doit fonctionner puisque cela fonctionne chez moi.)
Dim
rngToPicture As Range, outlookApp As Object, Outmail As Object, strBody$, strTempFilePath$, strTempFileName$
Dim Prioritaire$, Niveau2$
Dim sigstring As String
Dim signature As String
sigstring = Environ("appdata") & "\Microsoft\Signatures\"
f = Dir(sigstring & "*.htm")
signature = Getboiler(sigstring & f)
strTempFileName = "RangeAsPNG"
Set rngToPicture = Range("A8:c13")
Set outlookApp = CreateObject("Outlook.Application")
Set Outmail = outlookApp.CreateItem(0)
'Create an email
Prioritaire = Cells(3, 2).Value
Niveau 2 = Cells(7, 3).Value
With Outmail
If Cells(6, 3) = "A faire" Then
.to = "...…….."
.Subject = "A faire "
Call createPNG(rngToPicture, strTempFileName)
strTempFilePath = Environ$("temp") & "\" & strTempFileName & ".png"
.Attachments.Add strTempFilePath, 1, 0
strBody = strBody & "Bonjour," & "<br/><br/>" & "Travail à faire" & "<br/><br/>"
strBody = strBody & "Un: " & Prioritaire & "<br/><br/>"
strBody = strBody & " Deux: " & Niveau 2 & " <br/><br/>"
strBody = strBody & "Merci" & " <BR/><br/> "
strBody = strBody & signature
.htmlbody = strBody
.send
End With
end if
Set Outmail = Nothing
Set outlookApp = Nothing
Set rngToPicture = Nothing
end sub
Sub createPNG(ByRef rngToPicture As Range, nameFile As String)
Dim wksName As String
wksName = rngToPicture.Parent.Name
On Error Resume Next
Kill Environ$("temp") & "\" & nameFile & ".png"
On Error GoTo 0
rngToPicture.CopyPicture
'Paste the picture in Chart area of same dimensions
With ThisWorkbook.Worksheets(wksName).ChartObjects.Add(rngToPicture.Left, rngToPicture.Top, rngToPicture.Width, rngToPicture.Height)
.Activate
.Chart.Paste
'Export the chart as PNG File to Temp folder
.Chart.Export Environ$("temp") & "\" & nameFile & ".png", "PNG"
End With
Worksheets(wksName).ChartObjects(Worksheets(wksName).ChartObjects.Count).Delete
End Sub
Je n'ai pas ajouté la function Getboiler mais elle est présente dans ma commande.
Merci