VBA

VBA: Send Email With Outlook Mail body Snapshot

In this article you will learn how to send an Outlook Email with mail body snapshot like Excel tables, Charts or images by using VBA. We will use “Mail Envelope” method to sending the email. This method is quite easy and small.

We have to create our data on a worksheet in email format and It will send the entire worksheet or selected range on outlook mail body.

As in the below given image range “A1:H31“will be send to on email. To,CC and Subject information have been given on column L.

Send Email With Outlook Mail body Snapshot
Send Email With Outlook Mail body Snapshot

 

 

How to create a macro to Send Email With Outlook Mail body Snapshot?

  • Copy the below given code
  • Open a new workbook or you can use your existing workbook also.
  • Go to Visual Basic Editor (Press Alt+F11)
  • Insert a new module (Press Alt+I+M)
  • Paste this code.
  • Save workbook as macro enabled.
  • Create the data in mail format.
  • Change the code according to your data range.
Sub Send_Email_With_snapshot()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")

Dim lr As Integer
lr = sh.Range("A" & Application.Rows.Count).End(xlUp).Row

sh.Range("A1:H" & lr).Select

With Selection.Parent.MailEnvelope.Item
.to = sh.Range("L6").Value
.cc = sh.Range("L7").Value
.Subject = sh.Range("L8").Value
.attachments.Add "C:\Users\User\Desktop\Projects\Mar-2018.xlsx"
.send
End With

MsgBox "Done"

End Sub

After running this macro, Outlook may show popup as given in below image.

Outlook Popup
Outlook Popup

Click on Allow to send the email.

 

Click here to download this Excel File.

Watch the video tutorial to learn this macro:

PK
My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 10 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.
https://www.pk-anexcelexpert.com

0 thoughts on “VBA: Send Email With Outlook Mail body Snapshot

  1. Насос для пруда System-X 2500. – https://7filtrov.shophttps://7filtrov.shop/upload/iblock/48d/48dcd85ba9f417d8d072d6cde0bce44c.jpg. – Насосы Messner серии System-X маленькие и универсальные насосы для пруда, декоративного водоема, ручья. Насосы Messner System-X часто применяются для подачи воды на декоративные фигурки-источники и фонтаны Насосы System-X, основные преимущества: особо прочное рабочее колесо насосавсе электрические части изолированы, залиты искусственной смолойпросты в обслуживании, не требуют применения специальных инструментовудобная ручка и устойчивая подставка, новый click-корпуссинхронный двигатель с постоянным магнитомблагодаря большой поверхности всасывания не требуется частого уходаМодели System-X 1501…4500 комплектуются регулятором протокаМодели System-X 2501…4500 пригодны для работы в морской водегарантия 3 года • фонтан • ручей. – Подробная информация – https://7filtrov.shop/catalog/nasosy/nasosy_dlya_pruda/4497/ – Насос для пруда System-X 2500

Leave a Reply

Your email address will not be published. Required fields are marked *