This macro will send the current workbook in an email through Microsoft Outlook. The Macro allows you to send the most recently saved version of the excel file you are working in as an attachment. You must use the email client Outlook and you will need to have an internet connection. The specifics of the email are all contained within the macro. This means that you will have to edit certain portions of the macro in order to send an email to the desired recipients and also with the desired message.
NOTE
In the macro code you should notice a series of lines which start at the line ".To" then ".CC" etc. This text reads exactly like it does in an email and you should fill in the space where it says ADD TEXT HERE with exactly what you would put in these areas of a regular email.
Where it reads ".To" and then says JOHNDOE@TEST.COM, replace this sample email with the email address or addresses where you would like this email to be sent.
Also, directly underneath the line which reads ".Attachments.Add ActiveWorkbook.FullName", you can enter additional attachments to add to the email. Sample code for this is ".Attachments.Add ("C:\myfiles\another_file.xls")" This means that another file on your computer located in the folder C:\myfiles\ will be sent with this email as an attachment; the file's name (including file extension [.xls]) is "another_file.xls"
Sub Send_Email_Current_Workbook()
'
' Email Course: https://www.teachexcel.com/premium-courses/96/send-emails-from-excel-course?src=macro50
'
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "JOHNDOE@TEST.COM"
.CC = "ADD TEXT HERE"
.BCC = "ADD TEXT HERE"
.Subject = "ADD TEXT HERE - Subject"
.Body = "ADD TEXT HERE"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub