Hi All, I have converted a macro to code as I need to add acExportQualityPrint so my PDF that gets emailed retains good quality. I would have just kept it as a Macro (if anyone knows how to do it within Macro) but by efault the Macro doesnt have the option to change quality on sendobject.
So I converted to a module (below) but I get a Compile Error when I run it. I dont know much about VBA so am stuck. Any help?
Thanks
So I converted to a module (below) but I get a Compile Error when I run it. I dont know much about VBA so am stuck. Any help?
Thanks
Code:
Option Compare Database
'------------------------------------------------------------
' INVOICEFOREMAIL
'
'------------------------------------------------------------
Function INVOICEFOREMAIL()
On Error GoTo INVOICEFOREMAIL_Err
With CodeContextObject
DoCmd.GoToRecord , "", acNext
DoCmd.GoToRecord , "", acPrevious
DoCmd.OpenReport "InvoiceEmail", acViewPreview, "", "[Invoice No]=[Forms]![Invoices]![Invoice No]"
DoCmd.SendObject acReport, "", "PDFFormat(*.pdf)", .Email, .Email2, .Email3, .Email_Subject, "Dear " + .Title + " " + .FirstName + " " + .LastName + "," + " "
Please Print Attached Invoice Number" + .Invoice + ".
Our payment terms are BY RETURN unless pre-agreed. We appreciate speedy payment & thank you for your custom.
Accounts Department ", True, """
End With
INVOICEFOREMAIL_Exit:
Exit Function
INVOICEFOREMAIL_Err:
MsgBox Error$
Resume INVOICEFOREMAIL_Exit
End Function