Image qui ne s'affiche pas dans un mail Outlook
Bonjour,
J'envoie un mail Outlook avec le VBA. Et ce mail contient un graphique converti en image .png
Le problème c'est que cette image est bien visible aux internes de la société, mais invisible chez les autres collaborateurs externes.
Ci dessous le code que j'utilise:
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Sub createJpg(Namesheet As String, nameRange As String, nameFile As String)
ThisWorkbook.Activate
Worksheets(Namesheet).Activate
Set Plage = ThisWorkbook.Worksheets(Namesheet).Range(nameRange)
Plage.CopyPicture
With ThisWorkbook.Worksheets(Namesheet).ChartObjects.Add(Plage.Left, Plage.Top, Plage.Width, Plage.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("TEMP") & "\" & nameFile & ".png", "PNG"
End With
Worksheets(Namesheet).ChartObjects(Worksheets(Namesheet).ChartObjects.Count).Delete
Set Plage = Nothing
End Sub
Sub EnvoiSTAT()
Application.ScreenUpdating = False
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim olFormatHTML As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = Sheets("Options").Range("C7")
On Error Resume Next
With OutMail
.To = Sheets("Options").Range("C4")
.CC = Sheets("Options").Range("C5")
.BCC = ""
.Subject = Sheets("Options").Range("C7")
.BodyFormat = olFormatHTML
.HTMLBody = Sheets("Options").Range("C9") & "<br>"
<BR>Cordialement"
'.Display 'Pour afficher en cas de vérif
Call createJpg("Evolution", "B4:H51", "DashboardFile")
TempFilePath = Environ$("TEMP") & "\"
.Attachments.Add TempFilePath & "DashboardFile.png", olByValue, 0
.HTMLBody = .HTMLBody _
& "<img src='cid:DashboardFile.png'" _
& "<br>"
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub |
Pour faire simple, l'image est invisible aussi quand je l'envoie sur mon gmail. Pourriez-vous me donner un coup de main sur ce sujet svp ?
Cdt;