I am trying this too, and tried to adapt this code to send a single report. I have this code set up to run when a job description form is Closed. It does nothing, doesn't trigger an error even.
I also have noted that in my External Data menus, Create Email is greyed out. I have tried various forms of this code too: Docmd.Sendobject acSendReport, "reportname", acFormatPDF and nothing happens. I am wondering if these issues are connected (Perhaps the IT Masters at work are not allowing me to do this)?
I know very little about what all this code means, so thanks for bearing with me.
My code looks like this:
Public Sub SendEmail()
Dim appOutLook As Object
Dim MailOutLook As Object
DoCmd.OutputTo acOutputReport, "Submitted Jobs", acFormatPDF, "C:\Users\Me\Documents\Submitted Jobs", False
'assign our object references
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
'set the recipient list
.To = "me(a)mycompany(dot)com"
'set the subject
.Subject = "New Job"
'set the body text
.body = "Evaluate the job"
'add the reports we created
.attachments.Add "C:\Users\Me\Documents\Submitted Jobs"
'send the email
.Send
End With
'tidy up..
'get rid of our object references
Set appOutLook = Nothing
Set MailOutLook = Nothing
'delete our temporary files
Kill "C:\Users\Me\Documents\Submitted Jobs"
End Sub
Private Sub Form_Close()
End Sub