Good afternoon all,
Is there an easyish way to add a worksheet to an email! This is the code I have already, i want to add a certain worksheet!
'it is set to .Display so the email can be checked before it is sent
Sub InspectionEmail(Names As String)
Dim OutApp As Object ' holder for outlook app
Dim OutMail As Object 'container for outlook mail
Set OutApp = CreateObject("Outlook.Application") ' create the mail object
Set OutMail = OutApp.CreateItem(0) ' create the mail item
With OutMail ' build the email from information in the cells on the worksheet
'Reminder Email
'create the email
.To = Names
.CC = "test@test.com"
'.BCC = MailDest ' this will be used if you are sending to multiply people and don't want them to see the other receipients (10 max)
.Subject = " Monthly Vehicle Inspection Reminder "
.Body = " Hi " & vbNewLine & vbNewLine & "Please be advised that the Monthly Vehicle Inspections are due no later than the last day of the Month @ 17:00. " & ExpDateMail & vbNewLine & vbNewLine & "Please contact either Ben Pollard or the T Brown Compliance Department if you have any queries."
.Display
'Send ' I have left this in case your want to action from display to send
Set OutMail = Nothing
Set OutApp = Nothing
Exit Sub
End With
'clean up the mail object and item
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Is there an easyish way to add a worksheet to an email! This is the code I have already, i want to add a certain worksheet!
'it is set to .Display so the email can be checked before it is sent
Sub InspectionEmail(Names As String)
Dim OutApp As Object ' holder for outlook app
Dim OutMail As Object 'container for outlook mail
Set OutApp = CreateObject("Outlook.Application") ' create the mail object
Set OutMail = OutApp.CreateItem(0) ' create the mail item
With OutMail ' build the email from information in the cells on the worksheet
'Reminder Email
'create the email
.To = Names
.CC = "test@test.com"
'.BCC = MailDest ' this will be used if you are sending to multiply people and don't want them to see the other receipients (10 max)
.Subject = " Monthly Vehicle Inspection Reminder "
.Body = " Hi " & vbNewLine & vbNewLine & "Please be advised that the Monthly Vehicle Inspections are due no later than the last day of the Month @ 17:00. " & ExpDateMail & vbNewLine & vbNewLine & "Please contact either Ben Pollard or the T Brown Compliance Department if you have any queries."
.Display
'Send ' I have left this in case your want to action from display to send
Set OutMail = Nothing
Set OutApp = Nothing
Exit Sub
End With
'clean up the mail object and item
Set OutMail = Nothing
Set OutApp = Nothing
End Sub