Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
congtop  
#1 Posted : Monday, February 17, 2020 12:40:52 PM(UTC)
congtop

Rank: Newbie

Groups: Registered
Joined: 2/17/2020(UTC)
Posts: 0

Hi,

I have purchased the SMTP Component to use with VBA/Excel. BTW - haven't found much documentation on what the bodyFormat property; would like to see more. We have about 5 charts in Excel that we want to paste into an email and send out periodically using VBA. I'm guessing I need to somehow convert these to html but I'm not sure how to go about it. Can you please provide some guidance?

Thank you,

Topher
congtop  
#2 Posted : Monday, February 17, 2020 1:29:19 PM(UTC)
congtop

Rank: Newbie

Groups: Registered
Joined: 2/17/2020(UTC)
Posts: 0

So I got it to export the charts as images...

Sheets(1).ChartObjects("Chart 1").Chart.Export "C:\Chart1.png"

Then I build some HTML...

myHTML = "<!DOCTYPE html><html><body>"
myHTML = myHTML & "<img src='c:\Chart1.png'>"
myHTML = myHTML & "</body></html>"


Then I use...

SendMailTo(me, myself, andi@i.com, "Does this work?", myHTML, 1)

And it sends....

And in Gmail I get blank email. And it I look at everything, it has the <img src='c:\Chart1.png'> lines in what was received.

Where am I going wrong?

Edited by user Monday, February 17, 2020 1:47:48 PM(UTC)  | Reason: code snippets are not actual - redacted to protect the innocent.

ivan  
#3 Posted : Monday, February 17, 2020 7:07:36 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)
Originally Posted by: congtop Go to Quoted Post
So I got it to export the charts as images...

Sheets(1).ChartObjects("Chart 1").Chart.Export "C:\Chart1.png"

Then I build some HTML...

myHTML = "<!DOCTYPE html><html><body>"
myHTML = myHTML & "<img src='c:\Chart1.png'>"
myHTML = myHTML & "</body></html>"


Then I use...

SendMailTo(me, myself, andi@i.com, "Does this work?", myHTML, 1)

And it sends....

And in Gmail I get blank email. And it I look at everything, it has the <img src='c:\Chart1.png'> lines in what was received.

Where am I going wrong?


If you want to import linked image as embedded images, please change this line:
Code:

oSmtp.BodyText = body
' to
oSmtp.ImportHtml body, "c:"

' c: is the base path of your image if relative path is used in your html source, because you used full path
' you can input any value here.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.078 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.