General discussion


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.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by bschaettle In reply to Excel Macro for emailing

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

Set objEmail = CreateObject("CDO.Message")
objEmail.From = ""
objEmail.To = ";;"
objEmail.Subject = "This is the subject line"
objEmail.Textbody = "message body goes here"
objEmail.Configuration.Fields.Item ("") = 2
objEmail.Configuration.Fields.Item ("") = "your_mail_server_name"
objEmail.Configuration.Fields.Item ("") = 25
Set objEmail = Nothing

Related Discussions

Related Forums