I am clueless so apologies if this is annoying.
After a day of googling I have found something else that allows me to export my report as html and add it to the body of an email..
Code:
Private Sub Command40_Click()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
DoCmd.OutputTo acOutputReport, "Rpt_Ship_Confirm", acFormatHTML, "C:\Users\XXXXXXX\Desktop\Jordon Test DB\Rpt_Ship_Confirm.html"
Open "C:\Users\XXXXXXX\Desktop\Jordon Test DB\Rpt_Ship_Confirm.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
End Sub
This is fine but I would like to somehow incorporate the recipient email, cc, and subject (especially if I can pull the order no from the query for the subject)
Code:
Dim strSubject, strBody, strAddresses, strCC As String
strSubject = "Here's my report!"
strAddresses = "email@email.co.uk"
strCC = "Blah@hotmail.com"
DoCmd.SendObject acSendNoObject, , acFormatTXT, strAddresses, strCC, , strSubject, strBody, True
Exit Sub
Is there a way I can get this information onto the email that is generated with the top method?
can I also get populate the subject with information in the underlying query for the report?