Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Create And Send Email in Outlook


Sending bulk emails with formatting and with dynamic values in outlook with excel is very easy. This sample code teaches how to send email in outlook using excel.

' Add reference Microsoft Outlook Object Library

Sub SendEmailMesssage()
Dim objOL As New Outlook.Application
Dim objMail As MailItem

Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)

With objMail
.To = "toname@test.com"
.Subject = "Excel VBA to Outlook Message Example"
.Body = "This is an automated message from Excel."
.Display
'.Send 'Using send will directly send the mail
End With

Set objMail = Nothing
Set objOL = Nothing
End Sub

Subscribe

Enter your e-mail below and get notified on the latest blog posts.




Tags

VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts


Follow Us