Add Access Report with Hard Coded Attachments

Novice1

Registered User.
Local time
Today, 10:00
Joined
Mar 9, 2004
Messages
385
Can I add an Access report to the following e-mail? If so, how?


Dim OLApp As Outlook.application
Dim OLMsg As Outlook.MailItem

Set OLApp = New Outlook.application
Set OLMsg = OLApp.CreateItem(olMailItem)

With OLMsg
.Display
.To = "abc@xyz.com"
.Subject = "test email"
.body = "This is the body of the email."
.attachments.Add "M:\Checklist.docx"
.attachments.Add "M:\Checklist2.docx"

End With

Set OLMsg = Nothing
Set OLApp = Nothing
 
You could use OutputTo to save it to a file and then attach that file.
 
How do I identify the file in the attachment field for the Object Name rather than the report?

DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:="rptAssignmentRIP", _
OutputFormat:=acFormatPDF, OutputFile:="C:\temp\RIP.pdf"
 
Is this what you're looking for?

.attachments.Add "C:\temp\RIP.pdf"
 

Users who are viewing this thread

Back
Top Bottom