Hi All,
I've been looking online for an answer but have not been able to find one.
I have a local Outlook Template OFT file and the script works fine with it, but I want to eliminate the need to share the template file as well, so I wanted to know if there was a way to use the macro on an embedded OFT file instead.
I've attached a sample of the spreadsheet.
Hope someone can shed some light on this.
Sheet1!A1 = Subject of Email
Sheet1!A2 = First Name
Sheet1!A3 = Last Name
The code I have so far is:
Embedded on Sheet1 is an Outlook OFT template file, so thats the file that I want to use for the above code instead of having a local path to the OFT file.
Hope someone can help
I've been looking online for an answer but have not been able to find one.
I have a local Outlook Template OFT file and the script works fine with it, but I want to eliminate the need to share the template file as well, so I wanted to know if there was a way to use the macro on an embedded OFT file instead.
I've attached a sample of the spreadsheet.
Hope someone can shed some light on this.
Sheet1!A1 = Subject of Email
Sheet1!A2 = First Name
Sheet1!A3 = Last Name
The code I have so far is:
VBA Code:
Private Sub SendEmail()
Dim NewEmail As MailItem
Dim PathFileName As String
PathFileName = "HOW_TO_LINK_TO_EMBEDDED_OBJECT_OFT_THAT_IS_ON_SHEET1???"
Set NewEmail = CreateItemFromTemplate(PathFileName)
With NewEmail
.Subject = Worksheets("Sheet1").Range("A1").Value
.HTMLBody = Replace(.HTMLBody, "#FNAME", Worksheets("Sheet1").Range("A2").Value)
.HTMLBody = Replace(.HTMLBody, "#LNAME", Worksheets("Sheet1").Range("A3").Value)
.SentOnBehalfOfName = "test@test.com"
BodyWithoutSignature = .HTMLBody
.Display
.HTMLBody = BodyWithoutSignature
End With
Next
End Sub
Embedded on Sheet1 is an Outlook OFT template file, so thats the file that I want to use for the above code instead of having a local path to the OFT file.
Hope someone can help