General discussion

Locked

Excel Macro for emailing

By autumncrest ·
I'd like to set up a macro to email my current file to several different email addresses. Two questions: #1 - how do I set that up? #2 - is there a way to prevent the message from MS Outlook that says something like "another program is trying to send an email on your behalf, would you like to continue", or something like that? Thanks

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by bschaettle In reply to Excel Macro for emailing

This code should be "close"...it's from a script file. For more information, read up on Collaboration Data Objects (CDO).


Set objEmail = CreateObject("CDO.Message")
objEmail.From = "you@yourdomain.com"
objEmail.To = "recipient_1@domain_name.com; recipient_2@domain_name.com; recipient_2@domain_name.com"
objEmail.Subject = "This is the subject line"
objEmail.Textbody = "message body goes here"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your_mail_server_name"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
Set objEmail = Nothing

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums