Function HEDLSnapshot(strReport As String, strEMail As String, strSubj As String, strText As String)
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strAttach As String
Dim blRet As Boolean
strAttach = "C:\TempSnp.snp"
DoCmd.OpenReport "Control2", , , , acHidden
DoCmd.OutputTo acReport, strReport, "SnapshotFormat(*.snp)", strAttach, False, ""
DoCmd.Close acReport, "Control2"
Dim objOutlSet
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'objMailItem.Display
objMailItem.Recipients.Add strEMail
objMailItem.Subject = strSubj
'MsgBox strSubj ' new line
objMailItem.Body = strText
objMailItem.Attachments.Add strAttach
objMailItem.Display
Set objMailItem = Nothing
Set objOutl = Nothing
If Not IsMissing(strAttach) Then
Kill strAttach
End If
End Function
|