Sub Mail_QUALITY_PDF()
'' Coded by Gary Hewitt-Long - 2023-10-06
Dim OutApp As Object
Dim OutMail As Object
On Error Resume Next
On Error GoTo 0
AttachmentName = "Quality.pdf"
DORFileLocation = "N:\Continuous%Improvements\PMS\DOR\Archived%DOR\"
myMessage = "<B> Outstanding NCR's and Customer Complaints </B> <BR> <BR>Good Morning, <BR> <BR>Please find attached a list of outstanding NCR's and Customer Complaints. If you have misplaced the original NCR, these are stored on the N drive and you can re-print. Thanks. <BR> <BR> <B>Have a Nice/Safe Day!</B> <BR> <B> <BR> <BR></B>"
EmailTo = ThisWorkbook.Sheets("Distribution_List").Range("J2").Value ' who it will email in the To Field, taken from the sheet Distribution List
EmailCC = ThisWorkbook.Sheets("Distribution_List").Range("J3").Value ' who it will email in the CC Field, taken from the sheet Distribution List
EmailBCC = ""
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = EmailTo
.CC = EmailCC
.BCC = ""
.Subject = "Quality - Overdue complaints and NCR's - " & Format(Date, "dd-mmm-yyyy")
.BodyFormat = 2 'olFormatHTML ' olFormatHTML seemed to stop working, use option 2 instead.
.HTMLBody = "<B> Quality </B> <BR> <BR>Good Day, <BR> <BR>Please find attached a listing of the TOP overdue Customer Complaints and NCR's. If you have misplaced the original NCR, these are stored on the N drive and you can re-print. Thanks. <BR> <BR> <B>Have a Nice/Safe Day!</B> <BR> <B> <BR> <BR></B>"
'.Attachments.Add Dest.FullName
'You can add other files also like this
.Attachments.Add ("N:\Continuous Improvements\PMS\DOR\Archived DOR\" & AttachmentName)
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub