Code:Function EmailSnpFile()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Dim strPath As String
'Output Report as Snapshot file
strPath = CurrentProject.Path
DoCmd.OutputTo acOutputReport, "Your Report Name", acFormatSNP, strPath & "\Report.snp"
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "email@mydomain.com"
.Subject = "Your Subject"
.BodyFormat = olFormatHTML
.HTMLBody = "" & "Your Email Body" & ""
.Attachments.Add strPath & "\Report.snp"
.Display
End With
End Function |