Be the first user to complete this post

  • 0
Add to List

Excel-VBA : Send a Simple Mail From MS Outlook Using Excel

This tutorial will teach you about how to send a simple text mail from Microsoft Outlook using excel-macro.

  • Create object of Outlook Application.
  • Create a Mail Item.
  • Compose and Send mail using mail Item.
  • Create object of Outlook Application.
Set otlApp = CreateObject("Outlook.Application")
  • Create a Mail Item.
Set olMail = otlApp.CreateItem(olMailItem)
  • Compose and Send mail using mail Item.
With olMail

.To = SendID

If CCID <> "" Then

.CC = CCID

End If

.Subject = Subject

.Body = Body

.Send

End With

Complete Code:

Sub sumit()
Dim mainWB As Workbook
Dim SendID
Dim CCID
Dim Subject
Dim Body

Set otlApp = CreateObject("Outlook.Application")
Set olMail = otlApp.CreateItem(olMailItem)
Set mainWB = ActiveWorkbook

SendID = mainWB.Sheets("Mail").Range("B1").Value
CCID = mainWB.Sheets("Mail").Range("B2").Value
Subject = mainWB.Sheets("Mail").Range("B3").Value
Body = mainWB.Sheets("Mail").Range("B4").Value
With olMail
.To = SendID
If CCID <> "" Then
.CC = CCID
End If
.Subject = Subject
.Body = Body
.Send

End With
MsgBox ("you Mail has been sent to " & SendID)
End Sub

Send a Simple Mail From MS Outlook Using Excel
Send a Simple Mail From MS Outlook Using Excel



Also Read:

  1. VBA-Excel: Working with Bookmarks- Insert text before Bookmark
  2. Send Mail With Link to a Workbook, From MS Outlook using Excel.
  3. VBA-Excel: Consolidator – Merge or Combine Multiple Excel Files Into One
  4. VBA-Excel: Add Worksheets For All The Given Dates Except Weekends and Copy The Common Template In Each Worksheet
  5. VBA-Excel: Add/Insert multiple Images/Pictures from a folder in Word Document