Good day all my smart people,
Here is my code:
Private Sub cmdEmailRpt_Click()
Dim FileName As String
Dim FilePath As String
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
'Save the report as a pdf file to a folder
FileName = Me.cboAdmin.Column(1) & Date
FilePath = "P:\Internal\Integration\Arlette\Licensing\Corporate\Certificates" & FileName & ".pdf"
'Create temporary file
DoCmd.OutputTo acOutputReport, "Rpt_MissingCert", acFormatPDF, FilePath
'Create the email
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = Me.txtEmail
.Subject = "RMF Licensing Database - Missing Certificates"
.Body = "Hello" & Me.txtFirstName & vbNewLine & vbNewLine & _
"I hope this email finds you and your family well!" & vbNewLine & _
"I need all PE's certificates at this time. Please see the attached report for your team missing certifcate." & vbNewLine & _
"Also, if I am missing any current PE within your office please submit them as well" & vbNewLine & _
"You can drop all certificates in this folder: H:\Standards\Stds Development\Licensing" & vbNewLine & vbNewLine & _
"Feel free to contact me with any question and/or comments" & vbNewLine & vbNewLine & _
"Thank you so much for your help!"
.Attachments.Add FilePath
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
'Delete temporary file
'Kill FilePath
End Sub
When I run it, I get Error 2501 - The OutputTo action was canceled - I've read some of the answers on another forum but no resolution. Is it something in my preference options?
What am I missing?:banghead:
Thank you for your help
Here is my code:
Private Sub cmdEmailRpt_Click()
Dim FileName As String
Dim FilePath As String
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
'Save the report as a pdf file to a folder
FileName = Me.cboAdmin.Column(1) & Date
FilePath = "P:\Internal\Integration\Arlette\Licensing\Corporate\Certificates" & FileName & ".pdf"
'Create temporary file
DoCmd.OutputTo acOutputReport, "Rpt_MissingCert", acFormatPDF, FilePath
'Create the email
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = Me.txtEmail
.Subject = "RMF Licensing Database - Missing Certificates"
.Body = "Hello" & Me.txtFirstName & vbNewLine & vbNewLine & _
"I hope this email finds you and your family well!" & vbNewLine & _
"I need all PE's certificates at this time. Please see the attached report for your team missing certifcate." & vbNewLine & _
"Also, if I am missing any current PE within your office please submit them as well" & vbNewLine & _
"You can drop all certificates in this folder: H:\Standards\Stds Development\Licensing" & vbNewLine & vbNewLine & _
"Feel free to contact me with any question and/or comments" & vbNewLine & vbNewLine & _
"Thank you so much for your help!"
.Attachments.Add FilePath
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
'Delete temporary file
'Kill FilePath
End Sub
When I run it, I get Error 2501 - The OutputTo action was canceled - I've read some of the answers on another forum but no resolution. Is it something in my preference options?
What am I missing?:banghead:
Thank you for your help