Seperate emails from Excel File

5 pts.
Tags:
Excel 2007
Mail merge
Microsoft Excel Mail Merge
I need to send a 500 e-mails separately to different users depending on their name and e-mail address.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hereafter a VBS example that reads a text file that contains email addresses and relative file to attach.
The c:\myfile.txt must be as follows:
<b>emailaddr@whatvere.com | c:|pathtothefile</b>

<pre>
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.OpenTextFile(“C:\myfile.txt”, 1)
Do Until objFile.AtEndOfStream
Params = Split(objFile.ReadLine,”|”)
Params Params(0),Params(1)
Loop
objFile.Close

Sub SendEmail(destemail,attachfile)
Set objEmail = CreateObject(“CDO.Message”)
objEmail.From = “youremail@company.com”
objEmail.To = destemail
objEmail.Subject = “Your file”
objEmail.Textbody = “Your file is in attachment”
objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “smarthost”
objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
objEmail.AddAttachment(attachfile)
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub
</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following