Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

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

This tuto­r­ial will teach you about how to send a sim­ple text mail from Microsoft Out­look using excel-macro.

  • Cre­ate object of Out­look Application.
  • Cre­ate a Mail Item.
  • Com­pose and Send mail using mail Item.

 

  • Cre­ate object of Out­look Application.
Set otlApp = CreateObject("Outlook.Application")
  • Cre­ate a Mail Item.
Set olMail = otlApp.CreateItem(olMailItem)

  • Com­pose and Send mail using mail Item.
With olMail

.To = SendID

If CCID <> "" Then

.CC = CCID

End If

.Subject = Subject

.Body = Body

.Send

End With

Com­plete 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 Sim­ple Mail From MS Out­look Using Excel

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: