In the example below I've attached an excel spreadsheet to an email message. Using the exportreport method of the data report you could export your report as an html file and then similarly attach it to an email.
Hope that helps
Stacey
'*************************************
'Example of ExportReport
Private Sub ExportMyReport()
' Export to a file named Daily.htm using the MyReport ExportFormat.
DataReport1.ExportReport "MyReport", "C:\Temp\Daily", True, False
End Sub
'************************************
'Example of Email with attachment
'create and send email
Dim cdoFolder As MAPI.Folder
Dim cdoMessages As MAPI.Messages
Dim cdoMessage As MAPI.Message
Dim cdoRecipients As MAPI.Recipients
Dim cdoRecipient As MAPI.Recipient
StartMail:
Set CDOSession = New MAPI.Session
CDOSession.Logon
Set cdoFolder = CDOSession.Outbox
Set cdoMessages = cdoFolder.Messages
Set cdoMessage = cdoMessages.Add
Dim cdoAttachments As MAPI.Attachments
Dim cdoAttachment As MAPI.Attachment
Set cdoAttachments = cdoMessage.Attachments
With cdoMessage
Set cdoAttachment = cdoAttachments.Add("ClaimForm.xls", Len(.Text) + 1, CdoFileData, App.Path & "\claimform.xls"
Set cdoRecipients = cdoMessage.Recipients
Set cdoRecipient = cdoRecipients.Add
cdoRecipient.Name = RS!emailadd
cdoRecipient.Resolve
.ReadReceipt = True
.Send (True)
End With
CDOSession.Logoff
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.