rikklaney1
Registered User.
- Local time
- Today, 05:37
- Joined
- Nov 20, 2014
- Messages
- 157
I have a report that I would like to set up to automatically send out at a certain time of day. I have been playing with code I found here and I have this so send an email invisibly...
Private Sub Command0_Click()
Email_Send_To = "email@email.com"
Email_Bcc = "email@email.com"
Email_Body = "Here is the report"
Email_Subject = "report name"
On Error GoTo debugs
Set mail_object = CreateObject("Outlook.Application")
Set mail_single = mail_object.CreateItem(0)
With mail_single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Send
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
Set mail_single = Nothing
If Started Then
mail_object.Quit
End If
End Sub
In the end I will add this to a timed event so nobody has to click anything.
So my question is what do I need to add to this to make it generate and attach a report to this email? Thanks in advance.
Private Sub Command0_Click()
Email_Send_To = "email@email.com"
Email_Bcc = "email@email.com"
Email_Body = "Here is the report"
Email_Subject = "report name"
On Error GoTo debugs
Set mail_object = CreateObject("Outlook.Application")
Set mail_single = mail_object.CreateItem(0)
With mail_single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Send
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
Set mail_single = Nothing
If Started Then
mail_object.Quit
End If
End Sub
In the end I will add this to a timed event so nobody has to click anything.
So my question is what do I need to add to this to make it generate and attach a report to this email? Thanks in advance.