Jeet_Dhillon
New Member
- Joined
- Jul 13, 2019
- Messages
- 19
Hello Friends,
I am trying to prepare a code to attach an active file and insert a specific template in the email body.
So far, my progress is mentioned below, and I need help with attaching a file with a template that is saved in the Shared folder on the network .
Sub SendWorkBook()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
'Set OutlookMail = OutlookApp.CreateItemFromTemplate("P:\Garage - Eglinton\Forepersons Report\Outlook Template\End of Shift Report.oft")'
On Error Resume Next
'With CreateObject("Outlook.Application").CreateItemFromTemplate("P:\Garage - Eglinton\Forepersons Report\Outlook Template\End of Shift Report.oft")'
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "testing"
.Body = "Testing ."
.Attachments.Add Application.ActiveWorkbook.FullName
.Display
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Thank you
I am trying to prepare a code to attach an active file and insert a specific template in the email body.
So far, my progress is mentioned below, and I need help with attaching a file with a template that is saved in the Shared folder on the network .
Sub SendWorkBook()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
'Set OutlookMail = OutlookApp.CreateItemFromTemplate("P:\Garage - Eglinton\Forepersons Report\Outlook Template\End of Shift Report.oft")'
On Error Resume Next
'With CreateObject("Outlook.Application").CreateItemFromTemplate("P:\Garage - Eglinton\Forepersons Report\Outlook Template\End of Shift Report.oft")'
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "testing"
.Body = "Testing ."
.Attachments.Add Application.ActiveWorkbook.FullName
.Display
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Thank you