Slight change to convert report to pdf and email needed - SOLVED
Dear all
I found this code on another thread and have modified it very slightly
Whilst it works great I need to modify it further by doing the following:
1. Adding
somewhere so it converts and attaches only the record I am currently viewing to the email. I'm guessing it goes on the DoCmd line but not sure where or how.
Any suggestions greatly anticipated
King regards
manc
Dear all
I found this code on another thread and have modified it very slightly
Code:
Public Sub SendEmail()
Dim appOutLook As Object
Dim MailOutLook As Object
DoCmd.OutputTo acOutputReport, "rptQuote", acFormatPDF, "c:\Test\Quotation.pdf", False
'assign our object references
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
'set the recipient list
.To = "someone@somewhere.com"
'set the subject
.Subject = "My Reports"
'set the body text
.body = "Here are the reports in pdf format"
'add the reports we created
.attachments.Add "c:\Test\Quotation.pdf"
.Display
End With
'tidy up..
'get rid of our object references
Set appOutLook = Nothing
Set MailOutLook = Nothing
'delete our temporary files
Kill "c:\Test\Quotation.pdf"
End Sub
Whilst it works great I need to modify it further by doing the following:
1. Adding
Code:
[Forms]![frmQuote]![QuoteNo]=[qryQuote]![QuoteNo]
Any suggestions greatly anticipated
King regards
manc
Last edited: