Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Location
    Auckland - New Zealand
    Posts
    9

    Question Unanswered: Email using Crystal Report Control

    Hi. I have searched heaps of threads but cannot find an answer.

    I have placed the "Crystal Report Control" component on a VB5 form, and am able to display a crystal 8.5 report with just the following code.

    CrystalReport.DataFiles(0) = txtDataPath
    CrystalReport.ReportFileName = txtReportPath & txtReportName
    CrystalReport.PrintReport

    Now instead of displaying on the screen I would like to email the report (as a pdf). I note that the Crystal Report Control has some Email Properties, so I have set those as follows.

    CrystalReport.EMailSubject = "Purchase Order"
    CrystalReport.EMailMessage = "Attached is our Purchase Order"
    CrystalReport.EMailToList = "accounts@company.co.nz"

    Now how do I action? Is there an equivalant to the PrintReport (or Action=1 which also prints).

    Or do I have to print to a pdf file, (which I could do by setting printer to cutepdf) and then emailing the file?

    Any suggestions, please post example code. I will understand better that way.
    Thanks Heaps.

  2. #2
    Join Date
    Aug 2003
    Location
    Auckland - New Zealand
    Posts
    9

    Lightbulb Further Progress on Emailing

    Ahhh - i have found that it is as simple as adding

    CrystalReport.PrintFileType = crptRTF ' Or xls etc - But No pdf option available
    CrystalReport.Destination = crptMapi ' Or crptExchange
    CrystalReport.PrintReport ' Or CrystalReport.Action = 1 does the same

    So now I can send my report as an attachment to an email, and so simply.

    Only two problems left
    1) I think this method only works with crystal report version 8.5 or less. Is there an equivalent for version 9,10,11? Everything Ive looked at so far is really complicated.
    2) How to send the report as a pdf? Can this be added as an option somehow?

    Any answers anyone? Cheers.

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Probably, you'll want to add a PDF print driver, print to a file, then, email the resulting file as an attachment. The Ostrosoft SMTP component works well for this.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  4. #4
    Join Date
    Aug 2003
    Location
    Auckland - New Zealand
    Posts
    9
    Thanks Lou - but dont really want to purchase a new component fot that.

    Is there an existing way to do it within VB and Crystal anyone?

Posting Permissions

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