Email Current Workbook & or Other Attachments

Add to Favorites
Author:

Send Emails from Excel Course

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"

Where to install the macro:  Module

Email Current Workbook & or Other Attachments

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





Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Email the Current Workbook (And Email Split Syntax Introduction)
: How to email the current workbook, the workbook with the code in it, and how to structure ...
Email Multiple Worksheets as a PDF Attachment
: Email multiple worksheets as a PDF attachment....
Email from Excel (The Full Guide) - With Multiple Recipients, Attachments, HTML, Signatures, Email Error Handling & More
: This is the full guide on sending emails from Excel and it covers everything you need to k...
Send Emails from Excel - Automatically and by Hand
Tutorial: The downloadable Excel file is now available only in the Send Emails from Excel cour...
Close Excel Workbook using VBA Macros
Tutorial: How to close an Excel workbook using VBA and macros, including how to save the file before...
Get Data from Separate Workbooks in Excel
Tutorial: How to get data from separate workbooks in Excel. This tutorial includes an example using ...


How to Install the Macro
  1. Select and copy the text from within the grey box above.

  2. Open the Microsoft Excel file in which you would like the Macro to function.

  3. Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.  Or For other ways to get there, Click Here.

  4. On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.

  5. If the Macro goes in a Module, Click Here, otherwise continue to Step 8.

  6. If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.

  7. If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.

  8. Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.

  9. You are now ready to run the macro.

Tutorial Details
Similar Content
Email the Current Workbook (And Email Split Syntax Introduction)
: How to email the current workbook, the workbook with the code in it, and how to structure ...
Email Multiple Worksheets as a PDF Attachment
: Email multiple worksheets as a PDF attachment....
Email from Excel (The Full Guide) - With Multiple Recipients, Attachments, HTML, Signatures, Email Error Handling & More
: This is the full guide on sending emails from Excel and it covers everything you need to k...
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course