2 Replies Latest reply: Mar 21, 2014 12:51 AM by iTree Consulting RSS

    How to insert an image in outlook box mail body.

    iTree Consulting

      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 "\\\Documents\OMS DASHBOARD.jpeg"

                objMail.attachments.add("\\\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:\\\Documents\OMS DASHBOARD.jpeg'</BODY></HTML>"


                Set objMail = Nothing

                Set objOutlk = Nothing

          Msgbox " Mail delivered"

      end sub