Hi guys,
I am working on an Excel file to send emails to clients using VBA. I am a complete beginner
I would like to know how to replace a value in my Outlook template by a value from excel.
For example: I want to replace the word #Client# by the cell value where the client name is.
Somehow, I managed to do this after many searches but as you can see there are no replace lines.
Thank you for your help!!!
Sub Email_From_Excel_Attachments()
Dim emailApplication As Object
Dim emailItem As Object
Dim path As String
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItemFromTemplate("C:\Users\ClaudiaR\Desktop\1.oft")
'Change to work email
emailItem.SendUsingAccount = "[email protected]"
emailItem.to = Range("R9").Value
emailItem.BCC = Range("R22").Value
'Subject
emailItem.Subject = "Business Appointment"
' Attach any file from your computer.
'emailItem.Attachments.Add Range("R34").Value
' Send or Display the Email
emailItem.Display
Set emailItem = Nothing
Set emailApplication = Nothing
End Sub
Bookmarks