\r\nSub SendHTML_And_RangeImage_As_Body_UsingOutlook()\r\n Dim olApp As Object\r\n Dim NewMail As Object\r\n Dim ChartName As String\r\n Dim imgPath As String\r\n \r\n On Error GoTo err\r\n \r\n Set olApp = CreateObject("Outlook.Application")\r\n Application.ScreenUpdating = False\r\n Application.DisplayAlerts = False\r\n \r\n 'define a temp path for your image\r\n tmpImageName = VBA.Environ$("temp") & "\\tempo.jpg"\r\n \r\n 'Range to save as an image\r\n Set RangeToSend = Worksheets("Sheet1").Range("A3:M27")\r\n ' Now copy that range as a picture\r\n RangeToSend.CopyPicture Appearance:=xlScreen, Format:=xlPicture\r\n \r\n ' To save this as an Image we need to do a workaround\r\n ' First add a temporary sheet and add a Chart there\r\n ' Resize the chart same as the size of the range\r\n ' Make the Chart border as Zero\r\n ' Later once we export that chart as an image\r\n ' and save it in the above temporary path\r\n ' will delete this temp sheet\r\n \r\n Set sht = Sheets.Add\r\n sht.Shapes.AddChart\r\n sht.Shapes.Item(1).Select\r\n Set objChart = ActiveChart\r\n\r\n With objChart\r\n .ChartArea.Height = RangeToSend.Height\r\n .ChartArea.Width = RangeToSend.Width\r\n .ChartArea.Fill.Visible = msoFalse\r\n .ChartArea.Border.LineStyle = xlLineStyleNone\r\n .Paste\r\n .Export Filename:=tmpImageName, FilterName:="JPG"\r\n End With\r\n \r\n 'Now delete that temporary sheet\r\n sht.Delete\r\n \r\n ' Create a new mail message item.\r\n Set NewMail = olApp.CreateItem(0)\r\n \r\n With NewMail\r\n .Subject = "Your Subject here" ' Replace this with your Subject\r\n .To = "abc@email.com" ' Replace it with your actual email\r\n \r\n' **************************************************\r\n' You can desing your HTML body for this email.\r\n' below HTML code will display the image in\r\n' Body of the email. It will not go in attachment.\r\n' **************************************************\r\n .HTMLBody = "<body>Dear Sir\/Madam, \r\n\r\nKindly find the report below:" & _\r\n "\r\n<img src=" & "'" & tmpImageName & "'\/>\r\nRegards,\r\nLearnExcelMacro.com <\/body>"\r\n .Send\r\n \r\n End With\r\n\r\nerr:\r\n\r\n 'Release memory.\r\n ' Kill tmpImageName\r\n Set olApp = Nothing\r\n Set NewMail = Nothing\r\n Application.ScreenUpdating = True\r\n Application.DisplayAlerts = True\r\nEnd Sub\r\n\r\n<\/code><\/pre>\nAn Explanation : What this code does?<\/h1>\n [checklist icon=”fa-check” iconcolor=”” circle=”” circlecolor=”” size=”13px” class=”” id=””][li_item icon=”fa-check”]Takes the Range provided by you and copy it as a Picture[\/li_item][li_item icon=”fa-check”]Creates a Temp worksheet and add a Chart and paste this image in to a Blank Chart[\/li_item][li_item icon=”fa-check”]Now export this chart as an Image and save it to a temp folder[\/li_item][li_item icon=”fa-check”]Create your mail in Outlook and Draft your Mail in HTML as shown in the above code and then send the email.[\/li_item][li_item icon=”fa-check”]Now delete the temp sheet and temp image from temp folder and release all the objects created for outlook.[\/li_item][\/checklist]<\/p>\n
[content_boxes layout=”icon-on-side” columns=”1″ icon_align=”left” title_size=”” backgroundcolor=”#fff6d1″ icon_circle=”” icon_circle_radius=”” iconcolor=”” circlecolor=”” circlebordercolor=”” circlebordercolorsize=”” outercirclebordercolor=”” outercirclebordercolorsize=”” icon_size=”20″ link_type=”” link_area=”” animation_delay=”” animation_offset=”” animation_type=”0″ animation_direction=”down” animation_speed=”0.1″ margin_top=”” margin_bottom=”” class=”” id=””][content_box title=”Important” icon=”fa-bullhorn” backgroundcolor=”” iconcolor=”” circlecolor=”” circlebordercolor=”” circlebordercolorsize=”” outercirclebordercolor=”” outercirclebordercolorsize=”” iconrotate=”” iconspin=”no” image=”” image_width=”35″ image_height=”35″ link=”” linktarget=”_self” linktext=”” animation_type=”0″ animation_direction=”down” animation_speed=”0.1″]Make sure that your image is not deleted before the email is actually sent. .Send <\/strong> command creates the mail and trigger a send.. that is it. It does not wait for actually email to be sent from the outbox. In such case if your image is deleted before your email is actually sent, then You may see that your image is not part of the email because it was deleted before email was sent actually. This is the reason I have commented the delete statement (‘ Kill tmpImageName) of the temp image.[\/content_box][\/content_boxes]<\/p>\nDownload Sample<\/h1>\n Here is your sample workbook to play with.<\/p>\n\n<\/span>","protected":false},"excerpt":{"rendered":"Dear Friends, Couple of my friends asked me about this like how can I send screenshot of a particular range area of my excel sheet embedded in my HTML mail with other texts in my email. I also got this question on Microsoft Excel forum where I answered that question by providing a piece of […]<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1672,1675,1676],"tags":[],"class_list":["post-4755","post","type-post","status-publish","format-standard","hentry","category-excel-formula","category-excel-macro-for-beginners","category-excel-tips"],"yoast_head":"\n
Send Image of a Range from Excel embedded in Mail [Inline Image in Mail]<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n