
- #MICROSOFT VISUAL BASIC FOR APPLICATIONS 2013 HOW TO#
- #MICROSOFT VISUAL BASIC FOR APPLICATIONS 2013 CODE#
'' includes line breaks Line Breaks Line break in excel means inserting a new line in any cell value. HTMLBody includes signature from the outlook. HTMLBody = "Dear ABC" & "" & "" & "Please find the attached file" & Reference >You have check "MICROSOFT OUTLOOK 14.0 OBJECT LIBRARY" Dim OutlookApp As Outlook.Application
#MICROSOFT VISUAL BASIC FOR APPLICATIONS 2013 CODE#
'This code is early binding i.e in Tools > This makes the writing of code difficult because you need to be sure of what you are writing in terms of technique and spellings. The reason why we need to set the reference to object library because without setting the object library as “MICROSOFT OUTLOOK 14.0 OBJECT LIBRARY,” We cannot access the IntelliSense list of VBA properties and methods. To use the below code, you must set the object reference to “MICROSOFT OUTLOOK 14.0 OBJECT LIBRARY” under the object library of Excel VBA.īy setting the reference to the object, the library is called early binding.

To use Outlook features, we must first enable outlook scripting in VBA, and then use the application method. Use the below VBA code to send emails VBA Code To Send Emails We can use VBA to automate our mailing feature in Excel to send emails to multiple users at once. Now, this code will send the email from your VBA outlook mail. Step 16: Finally, send the email by using the Send method.

If you want to send the current workbook as an attachment, then use the attachment as This workbook. Step 8: First, select the body format as olFormatHtml. Step 7: Now, inside the with the statement, we can see the IntelliSense list by putting a dot. Now we can access all the items available with email items like “Body of the email,” “To,” “CC,” “BCC,” “Subject,” and many more things. Step 6: Now using With statement access VBA Outlook Mail. Set OutlookMail = OutlookApp.CreateItem(olMailItem) Set OutlookMail=OutlookApp.CreateItem(olMailItem)

Step 5: Now, set the second variable, “OutlookMail,” as below.
#MICROSOFT VISUAL BASIC FOR APPLICATIONS 2013 HOW TO#
In this article, I will show you how to work with Microsoft Outlook object from excel using VBA coding VBA Coding VBA code refers to a set of instructions written by the user in the Visual Basic Applications programming language on a Visual Basic Editor (VBE) to perform a specific task. This sounds awkward but at the same time puts a smile on our face as well. We can work with Microsoft word document, and finally, we can send the emails as well. The beauty of VBA is we can reference other Microsoft objects like PowerPoint, Word, and Outlook. We have seen VBA in excel and how we automate our tasks in excel with creating macros, in Microsoft Outlook we also have a reference for VBA and using which we can control outlook using VBA, this makes our repeated tasks in outlook easier to automate, and similar to excel we need to enable the developer feature to use VBA in outlook.
