Hi guys,
I am working on an Excel file to send different email templates to different recipients from a list.
I'm completely newbie in VBA. I had the code bellow from a previous project but it works only for one row.
The template directory is taken from K2. The templates are different based on clients.
the client's email is taken from B2 and client number is taken from A2.
I would like to make this code work for the whole list.
Your help is very appreciated.
Thanks a lot.
Claudia
Sub ESign_ES()
Dim emailApplication As Object
Dim emailItem As Object
Dim sBody As String
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItemFromTemplate(Range("K2").Text)
emailItem.to = Range("B2").Value
emailItem.Subject = "Business Appointment"
sBody = emailItem.HTMLbody
sBody = Replace(sBody, "#$ClientNumber#", Range("A2").Text)
emailItem.HTMLbody = sBody
emailItem.Display
Set emailItem = Nothing
Set emailApplication = Nothing
End Sub
Bookmarks