Sub SendEmail()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailBody As String
Dim EmailTo As String
Dim EmailCC As String
Dim EmailBCC As String
EmailSubject = "Subject of the Email"
EmailBody = "Body of the Email"
EmailTo = "email@example.com"
EmailCC = "cc@example.com"
EmailBCC = "bcc@example.com"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmailTo
.CC = EmailCC
.BCC = EmailBCC
.Subject = EmailSubject
.Body = EmailBody
.Display 'Change to .Send to send automatically without displaying
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
This code uses the CreateObject method to create a new instance of the Outlook application and the CreateItem method to create a new email message. You can customize the email details such as the recipient, subject, body, CC, and BCC fields.
