VB code to email Crystal report
Hi,
Anyone could help me for VBcode to send Crystal report by email? I have the code to print out the crystal report, but now i need the report can be email directly.
Below is my Print out sample:-
Public Sub ShowSalesInv(ByVal blnPreview As Boolean, ByVal sInvRefNo As String)
Dim SalesInvReport As Report
Dim Db As Database
Dim strTitle As String
Set SalesInvReport = New ICRSalesInv
Set Db = SalesInvReport.Database
SalesInvReport.RecordSelectionFormula = " {tbl_Sales.InvRefNo}='" & sInvRefNo & " '"
If blnPreview = True Then
Set frmCrystalViewer.mRptReport = SalesInvReport
frmCrystalViewer.Caption = strTitle & "Invoice"
frmCrystalViewer.Show 1
Else
SalesInvReport.PrintOut True does any code could replace here for email?
End If
End Sub
Would appreciate for any help. Thanks.
-Ana-
Re: VB code to email Crystal report
Looks like you may be using the CR Viewer control on your form? If so you can just package the emailing dependancies so the user can just click the export button and select email.
Re: VB code to email Crystal report
may i know how and where to get the emailing dependancies file??
Re: VB code to email Crystal report
In the Runtime.hlp help file that is included with CR Developer version. They are on your install of CR. Just so many of them and all are about a total of 20 MBs so you need to pick only what you need.
Re: VB code to email Crystal report
did u mean i have to re-install certain file from my CR software?
Re: VB code to email Crystal report
No, what version of CR 8.5 do you have? Is it the developer version? The help file only comes with Developer.
Re: VB code to email Crystal report
i'm using Crystal report IX developer version
Re: VB code to email Crystal report
I dont have that version but have you searched on the CR site?
Re: VB code to email Crystal report
Set all the appropriate ExportOptions and then call the Export method.
Code:
If blnPreview = True Then
Set frmCrystalViewer.mRptReport = SalesInvReport
frmCrystalViewer.Caption = strTitle & "Invoice"
frmCrystalViewer.Show 1
Else
SalesInvReport.ExportOptions.DestinationType= crEDTMicrosoftExchange
SalesInvReport.ExportOptions.MailToList = "....
SalesInvReport.Export
End If