I have looked on the site here forever and can't find a way to email a report in the body of the email.
I tried:
Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)
DoCmd.OutputTo acOutputReport, "rptShortReport", acFormatRTF, strOutputFile
If strOutputFile <> "" Then
fnum = FreeFile
Open strOutputFile For Input As #fnum
Do While Not EOF(fnum)
Line Input #fnum, strLine
BodyMsg = BodyMsg & strLine & vbCrLf
Loop
Close fnum
Else
MsgBox "Error in Email Transition!", vbCritical
End If
With myItem
.TO = strTo
.CC = strCCs
.subject = "My Report"
.Body = BodyMsg
.Display
End With
This works fine on my computer because of the Outlook settings and it looks great, but doesn't on some other computers. It will return the rich text format tags along with the text.
If I export the report as a text file and then read it back into the body, I lose the formatting.
I also tried the HTML export, but it seems to have bugs, because the report has lines missing or misplaced.
Anyone know how to do this?
Thanks!
I tried:
Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)
DoCmd.OutputTo acOutputReport, "rptShortReport", acFormatRTF, strOutputFile
If strOutputFile <> "" Then
fnum = FreeFile
Open strOutputFile For Input As #fnum
Do While Not EOF(fnum)
Line Input #fnum, strLine
BodyMsg = BodyMsg & strLine & vbCrLf
Loop
Close fnum
Else
MsgBox "Error in Email Transition!", vbCritical
End If
With myItem
.TO = strTo
.CC = strCCs
.subject = "My Report"
.Body = BodyMsg
.Display
End With
This works fine on my computer because of the Outlook settings and it looks great, but doesn't on some other computers. It will return the rich text format tags along with the text.
If I export the report as a text file and then read it back into the body, I lose the formatting.
I also tried the HTML export, but it seems to have bugs, because the report has lines missing or misplaced.
Anyone know how to do this?
Thanks!