Report insertion in outlook text body

syedadnan

Access Lover
Local time
Today, 19:21
Joined
Mar 27, 2013
Messages
315
Regards,

I have copied a VBA from the net and it is working fine and producing my report on outlook body text but one problem me facing is that it is pasting only first page if the second page is there it is not coming in outlook text body this what i want rest every thing is correct the code is:

Private Sub Command88_Click()

Const ForReading = 1, ForWriting = 2, ForAppending = 3

Dim fs, f
Dim RTFBody, strTo
Dim MyApp As New Outlook.Application
Dim MyItem As Outlook.MailItem

'DoCmd.OutputTo acOutputReport, "compliance", acFormatRTF, "compliance.rtf"
DoCmd.OutputTo acOutputReport, "compliance", acFormatHTML, "compliance.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("compliance.htm", ForReading)
'Set f = fs.OpenTextFile("Report1.rtf", ForReading)
RTFBody = f.ReadAll
f.Close

Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "Ehmke66@email.com"
.CC = "Ehmke66@email.com"
.Subject = "Dispute Update"
.HTMLBody = RTFBody
End With
MyItem.Display

End Sub
 
Regards,

I have copied a VBA from the net and it is working fine and producing my report on outlook body text but one problem me facing is that it is pasting only first page if the second page is there it is not coming in outlook text body this what i want rest every thing is correct the code is:

Private Sub Command88_Click()

Const ForReading = 1, ForWriting = 2, ForAppending = 3

Dim fs, f
Dim RTFBody, strTo
Dim MyApp As New Outlook.Application
Dim MyItem As Outlook.MailItem

'DoCmd.OutputTo acOutputReport, "compliance", acFormatRTF, "compliance.rtf"
DoCmd.OutputTo acOutputReport, "compliance", acFormatHTML, "compliance.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("compliance.htm", ForReading)
'Set f = fs.OpenTextFile("Report1.rtf", ForReading)
RTFBody = f.ReadAll
f.Close

Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "Ehmke66@email.com"
.CC = "Ehmke66@email.com"
.Subject = "Dispute Update"
.HTMLBody = RTFBody
End With
MyItem.Display

End Sub

Anyone could reply please
 
I agree with VbaInet. Typical reports are sent as attachments in PDF. Instead of outputting to HTML output to PDF and then attach the file to the MyItem.

DoCmd.OutputTo acOutputReport, "compliance", acFormatPDF, "compliance.pdf", True

MyItem.AddAttachment "compliance.pdf"
 
Is it possible to export an Access Report to HTML as a single .html, rather than multiple Page 1, Page 2, Page 3 etc...
 
Been going through my messages and came across this. I would imagine that you can but not through a report, you would just build loop through a recordset and create the HTML in code (or parse it).
 

Users who are viewing this thread

Back
Top Bottom