Hello all!
I have a database that I set up to send reports to specific e-mail recipients using this code:
‘Code for Microsoft Access – Send e-mail
DoCmd.SendObject acReport, "Report1", _
"RichTextFormat(*.rtf)", “recipient@recipientsemail.com”, "", "", Date & _
" Report”, _
"Attached is today’s report.", False, ""
I am curious to know if it is possible that when I send the reports, the e-mail is not saved to my Outlook 2000 ‘Sent Items’ folder. I have done this in Excel using code that I received from some helpful wizards on this board:
‘ Code for Microsoft Excel – Send e-mail – Delete from ‘Sent Items’ after sending
Sub SetRecipients()
Dim olApp As Object, olMail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
Set rngeAddresses = ActiveSheet.Range("Y3:Y7")
For Each rngeCell In rngeAddresses.Cells
strRecipients = strRecipients & ";" & rngeCell.Value
Next
'format e-mail
olMail.To = strRecipients
olMail.Attachments.Add ActiveWorkbook.FullName
olMail.Subject = Date & " Report"
olMail.Body = "Attached is today’s report"
olMail.DeleteAfterSubmit = True
olMail.Send
End Sub
Is there a way to adapt this code so it will work in Access?
I have a database that I set up to send reports to specific e-mail recipients using this code:
‘Code for Microsoft Access – Send e-mail
DoCmd.SendObject acReport, "Report1", _
"RichTextFormat(*.rtf)", “recipient@recipientsemail.com”, "", "", Date & _
" Report”, _
"Attached is today’s report.", False, ""
I am curious to know if it is possible that when I send the reports, the e-mail is not saved to my Outlook 2000 ‘Sent Items’ folder. I have done this in Excel using code that I received from some helpful wizards on this board:
‘ Code for Microsoft Excel – Send e-mail – Delete from ‘Sent Items’ after sending
Sub SetRecipients()
Dim olApp As Object, olMail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
Set rngeAddresses = ActiveSheet.Range("Y3:Y7")
For Each rngeCell In rngeAddresses.Cells
strRecipients = strRecipients & ";" & rngeCell.Value
Next
'format e-mail
olMail.To = strRecipients
olMail.Attachments.Add ActiveWorkbook.FullName
olMail.Subject = Date & " Report"
olMail.Body = "Attached is today’s report"
olMail.DeleteAfterSubmit = True
olMail.Send
End Sub
Is there a way to adapt this code so it will work in Access?