Trying to Create personalized emails, from a template, with multiple attachments

helios1014

New Member
Joined
Feb 18, 2018
Messages
1
I am looking for a method of creating a set of emails fitting the following parameters:

-each email will be personalized to the recipient and based off a template letter set by my supervisor.

-There will be a greeting line with their name and title, along with the names of the departments they oversee.

-each email will have a set of documents specific to that recipient.

-they should be saved to file for final inspection before they are sent.

-column 5 that is not referenced in the code below is the column containing the department name.

The closest I have come is the following code:

Sub send_template_w/attachments()

On Error Resume Next

Dim o As Outlook.Application

Set o = New Outlook.Application

Dim omail As Outlook.Mailitem

Set omail =.Createitem(olMailitem)

Dim I As Long

For i=2 To Range(“a100”).End(xlUp).Row

With omail

.Body = “Dear “ & Cells(i,1).Value

.To = Cells(i,2).Value

.CC = Cells(i,3).Value

.Subject = Cells(i,4).Values

.Attachments.Add Cells(i,6)

.Attachments.Add Cells(i,7)

.SaveAs Environ("HOMEPATH") &; "\My Documents" & Cells(i,2).Value

End With

Next

End Sub

So far this code will generate and save an email but what I want to do is use a present email template for these emails--either by adding the greeting at the beginning and department name into the body of the the email to be sent out. Can this be done through a word or Outlook document and if so, how?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top