Hi All,
Im using a macro that links attaches an active workbook to a specific outlook template. However, because im using the template, any time I try to add body to the template via code, it overwrites the template and the email just goes back to a normal one. Please note that within the body I would like to reference cells, hence it would need to be dynamic.
Is there any way to be able to add text to the email template body? Here is the code im working with:
Sub Mail_Workbook_1()
Dim OL As Object
Dim EmailItem As Object
Dim Wb As Workbook
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItemfromtemplate("C:\Users\blah\email_template.msg")
Set Wb = ActiveWorkbook
Wb.Save
With EmailItem
.Subject = "blah blah" & Worksheets(2).Range("c2") & " - " & Worksheets(2).Range("c4")
.To = Sheets(2).Range("C5").Value
.CC = Sheets(2).Range("C6").Value
.BCC = "blahblah@blah.com"
.Importance = olImportanceHigh 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Wb.FullName
.Save
End With
Application.ScreenUpdating = True
Set Wb = Nothing
Set OL = Nothing
Set EmailItem = Nothing
Set olMailItem = Nothing
End Sub
Thanks!
Tee
Bookmarks