How to …

12Dec/130

How to use .sendmail to multiple email addresses


I am using .SendMail in an Excel VBA Macro to send a workbook to an email address.  It works fine, but I needed to send to multiple recipients.

Here was the syntax I started with:

ThisWorkbook.SendMail "email@address1.com", "Text for the Subject Line"

When I tried to add multiple addresses, I tried commas, I tried semi-colons, and I tried an Array command, none of which worked.

Finally I realized that I was using messy syntax, and cleaned it up and got it to work this way:

ThisWorkbook.SendMail Recipients:=Array("email1@address1.com","email2@address1.com") Subject:="Text for Subject Line"

That worked!

That allowed me to mail (as an attachment) the workbook to multiple addresses without throwing any errors.

Linda - http://how.best-free-information.com - The "How" Blog

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]