Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xlDialogSendMail syntax

Status
Not open for further replies.

siktir23

Technical User
Mar 7, 2008
9
US
I am trying to add multiple email addresses to send an email in Outlook via a Microsoft Exchange Server. I can get it to send using one email address, but I can't figure out the syntax to add a second email address because Outlook doesn't recognize the automated input of the email addresses if they are separated by a semi-colon.

Example that works:
Application.Dialogs(xlDialogSendMail).Show "email1@address.com", "Subject"


Example that doesn't work:
Application.Dialogs(xlDialogSendMail).Show "email1@address.com; email2@address.com", "Subject"

Any suggestions? Thanks!

DJ

 
Have you tried a comma instead of the semi-colon ?
Have you tried to remove the space ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

Yes, I've tried every different syntax I can think of. It's like Outlook is trying to verify the entire line as one big email address.

If I click on each address, hit the space bar then back space, Outlook recognizes the first address, then if I space/back space on the second address, it does fine too. But, that kind of defeats the whle purpose.

I'm trying to make the process idiot proof for the people I work with.

Is there a way to add a second address to the CC block?



 
What about this ?
Application.Dialogs(xlDialogSendMail).Show Array("email1@address.com", "email2@address.com"), "Subject"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Nope, I get the same error when I click the "Send" button.

It's a "Check Names" error box that states:

Microsoft Office does not recognize "email1@address.com; email2@address.com".
 
A nice simple way to accomplish this is the declare the email addresses in variables then use:

Code:
ActiveWorkbook.SendMail _
     Recipients:=Array(emailaddy, emailaddy2, emailaddy3), _
     Subject:="Subject Goes Here"

This way you can have as many email addresses as you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top