PublishObject add chart to outlook

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(chartFile, 1)
strHTMLBody = FStream.ReadAll
FStream.Close
Set FStream = Nothing

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

Thanks
SL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top