G
Guest
Thanks PC Datasheet! I could not reply to the message.
Now I get argument blank or invalid...for this line:
DoCmd.OutputTo acOutputReport, strReportName, acFormatTXT,
strFileName
Below is the codein part from other site)
Public Sub olSendRpt(Optional strTo As String, Optional
strBody As String, Optional strSubject As String, Optional
strReportName As String)
'A procedure to send report in a body of mail message
'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
Now I get argument blank or invalid...for this line:
DoCmd.OutputTo acOutputReport, strReportName, acFormatTXT,
strFileName
Below is the codein part from other site)
Public Sub olSendRpt(Optional strTo As String, Optional
strBody As String, Optional strSubject As String, Optional
strReportName As String)
'A procedure to send report in a body of mail message
'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