This week, I was experimenting with sending email from Excel via Outlook. The goal was to send an email to each name in a list, and attach a couple of PDF files. Here’s how I managed to send email with PDF attachment from Excel.
The Sample File
So, before creating my complex email code, I set up a little test file, with a short list of fake customers. I created this file using Outlook and Excel 2013, but it should also work in Excel 2010, and perhaps Excel 2007 (see Ron de Bruin’s article for 2007 requirements).

Another sheet in the file has a report, to send to each customer, as a PDF attachment. I like pens, so my imaginary business is a pen shop.
The macro puts the current store number in cell E8, and INDEX/MATCH formulas pull the name and sales amount for that store.

Set Up the Email Settings Sheet
When doing the email tests, I wanted to be able to change some of the settings, without going into the VBA code. So, I added a Settings sheet, where you can:
- enter text for the subject line and email body
- select a folder where a copy of each PDF file will be saved
- enter an email address for receiving test emails

Send the Emails
The final sheet is the Menu, with buttons that run the macros.

If you’re sending out an email message to a list, it’s a good idea to test it first, by sending the reports to your own email address, instead of using your customers as guinea pigs!
So, click that “Send Test Emails” button, and see what arrives in your inbox. Check the PDF attachments, to make sure that the information is correct, and that each person is receiving the right attachment.
Then, if everything works well, you’re ready to click the “Send Store Emails” button, to send out the actual email.
More Excel Email Tips
For lots more examples of sending email from Excel, please visit Ron de Bruin’s website. He also shows how to use other mail programs, and different types of attachments.
Download the Sample File
To test the email code, you can download the sample file from my Contextures website. Go to the Send Email with PDF page, and in the download section, you can get the zipped Excel file.
The zipped file is in xlsm format, and contains macros. Be sure to enable macros, if you want to run the macro.
And be sure to test carefully, before you send a big email to your customers and co-workers!
_________________
Hi Debra, when sending test email I have no problems but when I send store emails, then although the dialog box comes up with “9 emails will be sent” and then the second dialog box “emails have been sent” shows, no emails actually get sent. Can you help solve this?
@Simon, do you have a valid email in each row in the table?
If you look in the Name Manager, does the named range include all the email address cells?
Yes, the name manager includes all 10 names in the range and the email addresses are valid. strangely, when I send Store Emails, it only says none emails will be sent. I have tried to check my sheet against the original that I have downloaded and cannot see any differences in the basic architecture.
Exelent VBA. I want to give one more box in the mail settings
“Enter the attachment file name”
I named a cell “rngfilename”
I changed the line
– strPDFName = “rngfilename” & c.Value & “.pdf”
but it is not works
What I have to change int the sendemailstores VBA sript?
Dear papsajt, the modified code you require is as follows:
strPDFName = wsS.Range(“rngfilename”).Value & c.Value & “.pdf”
no matter how many emails i put in the storelist tab I only get 4 emails
I noticed there is no way to copy data into the StoreList sheet. I had to insert 3200 rows then I was able to copy the info. I’m I missing something?