Example Code for sending mail from Excel
Ron de Bruin (last updated 2-March-2010)
Go back to the Excel tips page
The code is tested in Outlook Express, Windows Mail and Outlook and It may or may not work
with other email clients. All code on this page will also work in Excel 97-2010 or Excel 2000-2010.

There are three Microsoft mail programs:
Microsoft Outlook, Outlook Express, Windows Mail (new in Vista, replace Outlook Express). Microsoft
Outlook is a part of Microsoft Office and Outlook Express and Windows Mail are a part of the operating system.

The code in the "SendMail method" section of this tips page are working with all three the mail programs.
The code in the "Outlook object model (attachment and body)" section of this tips page are only working with Microsoft Outlook. Because there is an object model for Outlook you have much more options when
you use the code in this two sections. A good alternative for the Outlook object model code on this page is the
CDO for Win 2000
code on my CDO page (no security warnings)


Add-ins and Worksheet Templates

If you want it easy without using VBA code then try one of the Add-ins on this page
Mail Add-ins for Excel (Free and very easy to use)

Outlook Mail Worksheet Template for Excel 2007-2010
http://www.rondebruin.nl/mail/outlooksheettemplate.htm

Outlook Mail PDF Worksheet Template for Excel 2007-2010
http://www.rondebruin.nl/mail/outlooksheettemplatepdf.htm


 
SendMail method             Download Example Workbook 1
Mail the whole workbook
Mail one sheet
Mail more then one sheet
Mail Range or Selection
Mail every worksheet with address in A1
Mail a row or rows to each person in a range


Outlook object model (attachment)          Download Example Workbook 2
Mail the whole workbook
Mail one sheet
Mail more then one sheet
Mail Range or Selection
Mail every worksheet with address in A1
Mail a different file(s) to each person in a range
Mail chart or chart sheet as picture
Mail a row or rows to each person in a range
Mail Sheet, Sheets, Range or workbook as PDF in Excel 2007
Insert Outlook Signature in mail
Zip the Active Workbook and mail it with Outlook


Outlook object model (body)          Download Example Workbook 3
Mail one worksheet in the body of the mail
Mail Range/Selection in the body of the mail
Mail selection, range or worksheet in the body of a mail with MailEnvelope
Mail a small message
Mail a message to each person in a range
Mail every worksheet with address in A1 (Body)
Insert Outlook Signature in mail
Mail a row to each person in a range
Mail a row or rows to each person in a range
Send a mail when a cell reaches a certain value Updated

Other Tips

Sending mail from Excel with CDO (no security warnings) TIP
Use the Account you want in mail macro in Excel/Outlook 2007-2010
Save E-mail attachments to folder
Security (Prevent displaying the dialog to Send or not Send)
Problems with Mailing from Excel
Convert Excel data to Outlook Contacts
Links to information and articles about mailing in Excel

Send a range in the body with Outlook Express

Feel free to use this button if you want to support this site.