

Step 14: Press Tab on the subject IntelliSense and write a random subject as shown below.Ĭode: newmail.Subject = "This is an automated Email" When we write the instance name with a dot operator we can see the option for a subject as follows. What is the next step in sending an email? Note: BCC property is used when we want to hide the email address of the BCC receiver from the other receivers. So let us use the To property of outlook in excel as follows.Ĭode: newmail.To = 12: Since we have used the To property we have some another feature to use such as the Carbon Copy or the CC property of outlook.Ĭode: newmail.CC = we can use the BCC property. The first requirement is a receiver which is “To” in an email. Step 11: As I have explained above about what is the requirement to send an email.

Step 10: Similar to above with using another application in the example we need to create instances, now we need to create an instance for a new email which will open the new email using the set keyword.Ĭode: Set newmail = Email.CreateItem(olMailItem)īefore we move further let me explain our progress so far, the first instance will open outlook for us while the second instance will open the new email for us. Step 9: Now let us start with the mailing part in this code, to send an email we need to define another variable which will use the property of outlook to refer to a new email as shown below. Step 8: Since we want to send an attachment to the receiver we need to declare one variable as String which will hold the path for the attachment. Step 7: Like FSO, this variable is an object variable, so to access any other application we need to create some instances, create an instance as shown below using the SET keyword.Ĭode: Set Email = New Outlook.Application Now let us declare a variable as an outlook application. Step 6: By giving reference to the outlook above, we can now access the properties of outlook in VBA. Step 5: Define a subprocedure as shown below. Step 4: Click on insert tab and insert a module in the VBA project. Step 3: Clicking on the reference will open a wizard box for us, find a reference for Microsoft Outlook Object library and check it and then click on Ok.

Step 2: Go to Tools and then select References.

Step 1: In the Developer Tab click on Visual Basic to open the VB Editor.īefore we move into writing codes to send an email, we need to know this that outlook is an external object and we need to refer it in the VBA.
#Automailer xl download
You can download this VBA Send Email Excel Template here – VBA Send Email Excel Templateįollow the below steps to send email from Excel Using VBA code:
#Automailer xl how to
Let us learn how to send emails through outlook from excel in VBA by an example. In this example, we will also send an attachment to the receiver, the same excel file we will be writing the code. In layman’s term, what is the process and what is the requirement to send an email? An Email consists of an email address of the sender if there is a CC (Carbon Copy ) or a BCC and a subject line with an email body. Now the mailing feature is offered by Microsoft in Outlook, we will use methods and properties of outlook in excel to send emails. To send an email we need to know the basic of email also. This type of automation means accessing a feature of another application using any other application.
#Automailer xl code
It requires considerable knowledge of VBA and its methods to write the code to send emails from excel. Before we move to write and sending emails from excel let us know what this automation means. We can send emails through VBA and this is what we will learn in this article. VBA is not only limited to data in excel.
