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!

How to email the report from the data report

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
Hi,

Does anyone know how to email reports from data report in the outlook?


Thanks
 
Hi,

Does anyone know how to email reports from data report in the outlook?


Thanks
 
Not directly, but you could have the data report export as an html file and then email it as an attachment. I had to format and attach an excel file and send an automatic email
see code below:

Private Sub cmdSend_Click()
On Error GoTo ErrHand

DoEvents
'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 "", , True, True, frmEmail.hwnd, False
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
.Subject = dtebilldate & " " & RS!State & " " & RS!ban _
& " BILLING INQUIRY FORM" & _
" IC#: " & RSData!internalctrlnum
.Text = Space(2) & dtebilldate & " " & RS!State & " " & RS!ban _
& " BILLING INQUIRY FORM" & " IC#: " & RSData!internalctrlnum
ModifyAttachment
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
Unload Me

Exit Sub
ErrHand:
Select Case Err.Number
Case -2147221233
MsgBox "Invalid Profile Selected.", vbCritical + vbOKOnly + vbApplicationModal, "Error"
Resume StartMail
Case -2147221223
MsgBox "Outlook is currently open or being used." & _
vbNewLine & "Please close Outlook and try again.", _
vbOKOnly + vbInformation + vbApplicationModal, "Close Program"
Resume StartMail
Case Else
Err.Raise Err.Number
End Select

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top