Hi all,
I have the below code which saves the current worksheet as a PDF file and then sends the worksheet out, but I would rather it send the PDF, can someone help?
Thanks,
Karl
Dim OutApp As Object
Dim OutMail As Object
Dim saveLocation As String
Set wb1 = ThisWorkbook
saveLocation = "ADDRESS REMOVED" & Range("I4") & ".pdf"
'Save Active Sheet(s) as PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=saveLocation
' Create a new Outlook instance
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) ' 0 represents a mail item
' Compose the email
With OutMail
.To = Range("I12") & "@email.co.uk" ' Replace with the recipient's email address
'.CC =
.Subject = "Purchase Order " & Range("I4") & " : Approved" ' Replace with your email subject
.Body = "Please find attached your approved purchase order."
.Attachments.Add wb1.FullName
.Send
End With
' Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End If
I have the below code which saves the current worksheet as a PDF file and then sends the worksheet out, but I would rather it send the PDF, can someone help?
Thanks,
Karl
Dim OutApp As Object
Dim OutMail As Object
Dim saveLocation As String
Set wb1 = ThisWorkbook
saveLocation = "ADDRESS REMOVED" & Range("I4") & ".pdf"
'Save Active Sheet(s) as PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=saveLocation
' Create a new Outlook instance
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) ' 0 represents a mail item
' Compose the email
With OutMail
.To = Range("I12") & "@email.co.uk" ' Replace with the recipient's email address
'.CC =
.Subject = "Purchase Order " & Range("I4") & " : Approved" ' Replace with your email subject
.Body = "Please find attached your approved purchase order."
.Attachments.Add wb1.FullName
.Send
End With
' Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End If