Sending Report via Outlook

BrianFawcett

Registered User.
Local time
Today, 04:02
Joined
May 3, 2010
Messages
63
I am trying to automate sending reports from a database. I found some code and it looks like it's working, but the email doesn't generate. Can someone help me out. Here is my code:

Private Sub SendCODConflicts_Click()

DoCmd.RunMacro "SaveCODConflictReport", 1

Dim strAttach1 As String
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strAttach1 = "C:\Documents and Settings\bfawcett\My Documents\COD Order Conflict Report.pdf"

With objEmail
.To = "b.fawcett@neopost.com"
.Subject = "COD Order Conflict Report"
.Body = "Attached is today's COD order conflict report" & vbCrLf & vbCrLf & _
"Please contact me if you have any questions."
.Attachments.Add strAttach1
End With

End Sub
 
Try adding either of these after the attachment line, as desired:

.Display
.Send
 
Fantastic, thanks.
 

Users who are viewing this thread

Back
Top Bottom