Report as a message body

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Is it possible to send a report by mail, I need the report as a message
body. Normally it sends as an attachment. Is there any code, please help

Thanks
 
Send email from access as email body and not as attachment
Public Sub olSendRpt(strTo As String, strBody As String,
strSubject As String, strReportName As String)
'A procedure to send report in a body of mail message
'Alex Dybenko, http://Alex.Dybenko.com

'Usage: olSendRpt "(e-mail address removed)", "Pls see report
below", "My Report", "Report1"


Dim strFileName As String, intFile As Integer, strLine
As String, strTemplate As String

strFileName = Environ("Temp") & "\rep_temp.txt"

If Len(Dir(strFileName)) > 0 Then
Kill strFileName
End If
DoCmd.OutputTo acOutputReport, strReportName,
acFormatTXT, strFileName

intFile = FreeFile
Open strFileName For Input As #intFile
Do While Not EOF(intFile)
Line Input #intFile, strLine
strTemplate = strTemplate & vbCrLf & strLine
Loop
Close #intFile

DoCmd.SendObject acSendNoObject, "", acFormatTXT,
strTo, , , strSubject, strBody & strTemplate

End Sub
 
Back
Top