Sending email is a routine task for all kind of industry. it may be reporting, marketing, data science, communication, retail industry and so on. It will become a tedious job when same kind of email needs to be sent over multiple stakeholders.
Obviously, sending same kind of email with different kind of attachment is a quite time consuming and boring activity. Specially, when it comes to email marketing to send emails to various recipient including attachments specific to their needs.
Thus, there will be a requirement to automate this task and send emails to respective stakeholder at one button click. we can automate this task in excel itself. Using few lines of code in excel macro will serve the purpose if sending emails.
Here is the code which will be use to send email from excel:
Below code is written to send email for a single email ID
'Below code will be used to show created email. To send email replace Display with Send
Set oMail = Nothing
Set oApp = Nothing
'Enable screen updating
Application.ScreenUpdating = True
Now, We will write a VBA code which will send emails to multiple email IDs. Before writing a code we will need details of recipients, CC, BCC, Subject and attachment file path. Refer below snap which is having required details. you can create your own entries as per your need.
Make sure that above table is create in Sheet1 as we are using reference of Sheet1 in our code.
Given below is block of code which be used to send emails to multiple email IDs: