By Animesh Das

2018-07-11 15:41:26 8 Comments

Hi I am using below code to add chart and send email to multiple recipients. It works fine. In my sent item i can see a perfect email created and sent. But all the recipients are not able to see the charts. All they see is two red X

Sub Send_Email_Updated()

Dim olApp As Object
Dim NewMail As Object
Dim NewMail1 As Object
Dim ChartName As String
Dim ChartName1 As String
Dim SendingRng As Range
Dim htmlString As String
Dim OMail As Outlook.MailItem

Set wb = ActiveWorkbook
Set S1 = wb.Worksheets("Incident Tickets")
Set S2 = wb.Worksheets("Assets and Representatives")
Set S3 = wb.Worksheets("Email")

'Set SendingRng = Worksheets("Email").Table("A30:C43")
Set SendingRng = Worksheets("Email").Range("A30:C43")
Set olApp = CreateObject("Outlook.Application")
Set OMail = olApp.CreateItem(olMailItem)

' Group 1
If S3.Cells(7, 2) <> 0 Or S3.Cells(8, 2) <> 0 Or S3.Cells(9, 2) <> 0 Then


'fill in the file path/name of the gif file app graph
    ChartName = Environ$("Temp") & "\Chart 1.gif"

    ActiveWorkbook.Worksheets("Email").ChartObjects("Chart 1").Chart.Export _
    Filename:=ChartName, FilterName:="GIF"

'fill in the file path/name of the gif file trend graph
    ChartName1 = Environ$("Temp") & "\Chart 31.gif"

    ActiveWorkbook.Worksheets("Email").ChartObjects("Chart 31").Chart.Export _
    Filename:=ChartName1, FilterName:="GIF"

    Set NewMail = olApp.CreateItem(0)
    With NewMail
        .Subject = "Action Required on Incidents and Problem Candidates for GC060.1 - Group 1"
        .To = "[email protected]"

        .HTMLBody = 
        "<img src=" & "'" & ChartName1 & "'>" & "<br/>" & "<br/>" & "_
        "<img src=" & "'" & ChartName & "'>" & "<br/>" & "<br/>" & _

    End With

    ChartName = vbNullString
    ChartName1 = vbNullString

End If

End Sub


Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] How to add excel range as a picture to outlook message body

1 Answered Questions

Trying to create personalized emails with multiple attachments

0 Answered Questions

Send first and last row in body of Outlook email

3 Answered Questions

[SOLVED] Extract URL from body of email

1 Answered Questions

[SOLVED] Send Excel range including chart by email

1 Answered Questions

Outlook Email Body to Excel

2 Answered Questions

VBA code to search for an email and copy the body into excel

1 Answered Questions

[SOLVED] Inserting text in Email body using VBA

2 Answered Questions

[SOLVED] VBA-Trouble with attaching cells into body of email(Outlook)

Sponsored Content