Envoyer graphic via outlook
Bonsoir a tous.
le code suivant me permet d'envoyer un seul graphic dans le corps d'un mail jusque la ca fonctionne tres bien
ce que je souhaiterai c'est envoyer 2 graphic l'un en dessous de l'autre et malgre plusieurs tentatives je suis bloque
pourriez vous m'aider s'il vous plait
Merci
[code][/Sub SendChart_As_Body_UsingOutlook()
Dim olApp As Object
Dim NewMail As Object
Dim ChartName As String
Dim ChartName1 As String
Set olApp = CreateObject("Outlook.Application")
ChartName = Environ$("temp") & "\Chart1.gif"
ActiveWorkbook.Worksheets("Resultat").ChartObjects("Graphique 1").Chart.Export _
Filename:=ChartName, FilterName:="gif"
Set NewMail = olApp.CreateItem(0)
With NewMail
.Subject = "Please the attached Chart"
.To = "xxx"
.HTMLBody = "<img src=" & "'" & ChartName & "'>"
.Display
End With
Set olApp = Nothing
Set NewMail = Nothing
End Sub
code]
Bonjour,
à tester,
Sub SendChart_As_Body_UsingOutlook()
Dim olApp As Object
Dim NewMail As Object
Dim ChartName1 As String, ChartName2 As String
Set olApp = CreateObject("Outlook.Application")
ChartName1 = Environ$("temp") & "\Chart1.gif"
ChartName2 = Environ$("temp") & "\Chart1.gif"
ChartName1 = ThisWorkbook.Path & "\Chart1.gif"
ChartName2 = ThisWorkbook.Path & "\Chart2.gif"
ActiveWorkbook.Worksheets("Resultat").ChartObjects("Graphique 1").Chart.Export _
Filename:=ChartName1, FilterName:="gif"
ActiveWorkbook.Worksheets("Resultat").ChartObjects("Graphique 2").Chart.Export _
Filename:=ChartName2, FilterName:="gif"
Set NewMail = olApp.CreateItem(0)
With NewMail
.Subject = "Please the attached Chart"
.To = "xxx"
.HTMLBody = "<img src=" & "'" & ChartName1 & "'><br>" & "<img src=" & "'" & ChartName2 & "'><br>"
.Display
End With
Set olApp = Nothing
Set NewMail = Nothing
End Sub