I am trying to automate a template in outlook to automatically fill out certain fields based on data provided within the spreadsheet.
The spread sheet is called "Progress Report"
I want to grab the clients name, which is located in Column A
I want to insert the clients membership number which is located in Column G
The email template looks like this: https://imgur.com/a/jyuiM
The current macro I have only opens the template (which is still okay, would just like it to do a little more and unsure how). Here is the code:
Is there anyway I can set variables within the outlook template that can load from the excel spreadsheet?
The spread sheet is called "Progress Report"
I want to grab the clients name, which is located in Column A
I want to insert the clients membership number which is located in Column G
The email template looks like this: https://imgur.com/a/jyuiM
The current macro I have only opens the template (which is still okay, would just like it to do a little more and unsure how). Here is the code:
Code:
Sub LoadEmail()
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItemFromTemplate("W:\Client Letter Templates\Colonial Email Template\Colonial_Details.oft")
With otlNewMail
vTemplateBody = otlNewMail.HTMLBody
vTemplateSubject = otlNewMail.Subject
.Close 1
End With
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(0)
With otlNewMail
BodyWithoutSignature = .HTMLBody
.Display
.HTMLBody = BodyWithoutSignature
.SentOnBehalfOfName = vFrom
.Bcc = vToList
.Subject = vTemplateSubject
.HTMLBody = vTemplateBody
End With
End Sub
Is there anyway I can set variables within the outlook template that can load from the excel spreadsheet?