Results 1 to 9 of 9

Thread: VB code to email Crystal report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    107

    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-
    Last edited by anatasia; Mar 29th, 2007 at 03:51 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    107

    Re: VB code to email Crystal report

    may i know how and where to get the emailing dependancies file??

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    107

    Re: VB code to email Crystal report

    did u mean i have to re-install certain file from my CR software?

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    107

    Re: VB code to email Crystal report

    i'm using Crystal report IX developer version

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VB code to email Crystal report

    I dont have that version but have you searched on the CR site?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width