PublishObject add chart to outlook

  • Thread starter Thread starter stevenleongusa
  • Start date Start date
S

stevenleongusa

Hi,
I am trying to code a VBScript to get Excel chart and paste in
Outlook. For somereason, the email does not attach gif file but only
html body. Do you have a solution for this?

Set objChart = objExcel.ActiveSheet.ChartObjects("Chart 2")
objExcel.ActiveWorkbook.PublishObjects.Add(xlSourceChart,
chartFile, objChart.Parent.Name, objChart.Name, xlHtmlStatic,
"weekly_chart", "").Publish True


Set FStream = FSObject.OpenTextFile(htmlFile, 1)
strHTMLBody = FStream.ReadAll

FStream.Close
Set FStream = Nothing

Set FStream = FSObject.OpenTextFile(chartFile, 1)
strHTMLBody = FStream.ReadAll
FStream.Close
Set FStream = Nothing

With MailItem
.HTMLBody = strHTMLBody
.Subject = mySub
.To = myTo
.Display
End With

Thanks
SL
 
I am trying to code a VBScript to get Excel chart and paste in
Outlook. For somereason, the email does not attach gif file but only
html body. Do you have a solution for this?

Coding questions should be posted to microsoft.public.outlook.program_vba
 
Back
Top