Using VBA code builder in MS Access, I have been able to write code that opens Outlook and send me an email with the click of a button. I am having problems with adding an attachment. Most code I have found adds files outside the MS Database as an attachment, I would like to add a report created in my database as an attachment.
Private Sub EmailReport_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
'Email the results of the report generated
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = "[email protected]"
oEmail.Subject = "Training Roster"
oEmail.Body = "Roster Information"
With oEmail
.Send
MsgBox "Email Sent"
End With
I have been looking into a command similar to
oEmail.Attachments.Add Me.
..But, I cannot find the correct combination for adding my report. Thanks!!
Application.CurrentProject.Path &"\" & "filename.pdf"
so PDF is saved wherever database is located. – Delanty