PDF and email together

This is a newer and more efficient way of creating a PDF, saving it and emailing it out.


Sub pdf_and_email()
FName = "[email protected]"
DDate = Format(Now(), "mm-dd-yyyy-hh-mm-ss")
Subj = "Subject of email here"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & FName & ".pdf", Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

'Send the PDF out here

'*********************

emailname = FName
Set Mail_Object = CreateObject("Outlook.Application")
Set OMail = Mail_Object.Createitem(0)
With OMail
'.Display
Signature = OMail.htmlbody
.Close False
End With

'********************

With Mail_Object.Createitem(o)
.Subject = Subj ' CHANGE TO SUIT
.To = emailname 'CHANGE TO SUIT
.htmlbody = "

Hi,

Put the text for the email in here

Kind Regards

"
.Attachments.Add ThisWorkbook.Path & "\" & FName & ".pdf"
.Send
End With

Set Mail_Object = Nothing
Set OMail = Nothing

'*************************************************************************************************************************************************

End Sub






Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us
the webdesigner group security shielf
the webdesigner group logo

Close Button

Web Page Design by

The Web Designer Group