Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sona_sa
Creator II
Creator II

How to insert an image in outlook box mail body.

Hi Friends,

I want to send clipboard image by Outlook Box without any attachment. It should to go as an image in mail body. For this I am using the below macro. Please check it.

But my image is not going properly in mail body. I am able to send by attachment but not in mailbody. For more detail I am sending an jpeg, Please check it also.

sub mSendMail

          Dim objOutlk 'Outlook

          Dim objMail 'Email item

          Dim strMsg

          dim strMailTo

          dim sString

          dim oldFormat

          Dim Rng

          Const olMailItem = 0

          Const CdoReferenceTypeName = 1

          Set objOutlk = CreateObject("Outlook.Application")

          Set objMail = objOutlk.createitem(olMailItem)

          Set Rng = Nothing

          objMail.To = "amit.kumar@teamcomputers.com"

          objMail.subject = "OMS DASHBOARD"

          ActiveDocument.ActiveSheet.CopyBitmapToClipboard true

          ActiveDocument.Sheets("Dashboard-email").ExportBitmapToFile "\\172.16.11.211\Documents\OMS DASHBOARD.jpeg"

          objMail.attachments.add("\\172.16.11.211\Documents\OMS DASHBOARD.jpeg")

          strMsg = "This is an automatic generated email from QlikView for OMS DASHBOARD."

          objMail.body = strMsg

    objMail.HTMLBODY = "<HTML><BODY><img align=baseline border=0 hspace=0 src='cid:\\172.16.11.211\Documents\OMS DASHBOARD.jpeg'</BODY></HTML>"

            objMail.Send

          Set objMail = Nothing

          Set objOutlk = Nothing

    Msgbox " Mail delivered"

end sub

2 Replies
ericcosmai
Contributor III
Contributor III

Hi Amit.

I think the problem is in the HTML script ... try just

<HTML>

     <BODY>

          <img align=baseline border=0 hspace=0 src='\\172.16.11.211\Documents\OMS DASHBOARD.jpeg'>

     </BODY>

</HTML>

I wish it helps.

Regards.

sona_sa
Creator II
Creator II
Author

Thanks It is working.