G
Guest
Hello,
I made a program in Excel that mails the Activesheet.
For each email I add the name of the repicient. So it is personalized. I
want to use a specific Outlook template.
To do this, I have to save my Excelsheet first. But that takes a lot of time.
So, I want to send my email without saving.
I use the following code.
Sub SendMyEmail()
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItemFromTemplate _
("C:\Templates\WMR.oft")
Set wb = Workbooks(Active_Excel_File)
With wb
.SaveAs "C:\Temp\" & MySubject & " " & MyDate & ".xls"
With OutMail
.To = email
.Subject = MySubject & " " & MyDate
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill wb.FullName
Set OutMail = Nothing
Set OutApp = Nothing
End With
End Sub
Who can help me out?
Thanks a lot!
Willem
I made a program in Excel that mails the Activesheet.
For each email I add the name of the repicient. So it is personalized. I
want to use a specific Outlook template.
To do this, I have to save my Excelsheet first. But that takes a lot of time.
So, I want to send my email without saving.
I use the following code.
Sub SendMyEmail()
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItemFromTemplate _
("C:\Templates\WMR.oft")
Set wb = Workbooks(Active_Excel_File)
With wb
.SaveAs "C:\Temp\" & MySubject & " " & MyDate & ".xls"
With OutMail
.To = email
.Subject = MySubject & " " & MyDate
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill wb.FullName
Set OutMail = Nothing
Set OutApp = Nothing
End With
End Sub
Who can help me out?
Thanks a lot!
Willem