Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP!!! How can I send the report from data report in outlook.

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
Help!!!

How can I send the report from data report in outlook.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top