Solved

VB6 and CR 9   Emailing a .rpt

Posted on 2011-09-27
6
340 Views
Last Modified: 2012-05-12
Is it possible to run a crystal report using the crviewer in vb (already done) and email a copy of the report without having to export as a PDF first?
0
Comment
Question by:Jeff_Kingston
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710192
Without exporting to "something" I would say not you can not email a report simply from what is viewed on the screen.  If you already know how to make the pdf, that would be the best way to go.  You do not have to have the users interaction to do so.  If you have a button on screen, you could make the PDF and send the email in the background as long as you have a recipient and a sender address.
0
 

Author Comment

by:Jeff_Kingston
ID: 36710453
That sounds great, do you know where I could grab sample code?
0
 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710593
I use a tool called CodeStone to send emails with.

Public MySMTP As New SMTPClient
              Public MyPop3 As New POP3Client

              With New_Report
                   ' SHOULD YOU REQUIRE A PARAMETER FOR YOUR REPORT
                   .ParameterFields(1).AddCurrentValue Str(YOUR PARAMETER)
                   .ExportOptions.PDFExportAllPages = True
                   .ExportOptions.DestinationType = crEDTDiskFile
                   .ExportOptions.DiskFileName = "YourFilePath\" & sYourFileName & ".pdf"
                   .ExportOptions.FormatType = crEFTPortableDocFormat
                   .DisplayProgressDialog = False
                   .Export False
              End With

              Dim MyMsg As New CSMAILLib.MESSAGE

              MyMsg.Subject = sSubject
              MyMsg.To(1) = sRecipient
              MyMsg.From(1) = sSender
              ' SHOULD YOU HAVE CC OR BCC IN YOUR MAIL
              MyMsg.CC(1) = sCC  
              MyMsg.bCC(1) = sBCC
              Dim sSection As CSMAILLib.Section
              MyMsg.Sections(1).Body = Trim(sBody)
              Set sSection = MyMsg.Sections.Add
              sSection.AttachBodyFromFile ("YourFilePath\" & sYourFileName & ".pdf")
              ' for some exchange servers the user and pass are not required
              MySMTP.ConnectESMTP sSMTPServer, "", "", "", sSMTPPort  ' For Exchange 2010
              ' else use a user pass for a mail server
              MySMTP.ConnectESMTP sSMTPServer, sPOP3User, sPOP3Pass, sPop3Login, sSMTPPort
              MySMTP.SendMessage MyMsg
              MySMTP.Close

              ' when you are done it does not hurt to kill the file afterwards to keep things clean
              Kill ("YourFilePath\" & sYourFileName & ".pdf")

Open in new window

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710898
BTW - here is a link to the for the email tool
http://www.codestone.co.uk/
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 36713068
If you are using  MAPI mail system like Exchange you can load the MAPI export dlls and mail it directly from the viewer.  It goes as an attachment and the attachment can be a PDF.

Code is similar to the above except you choose the MAPI option and attachment format.

mlmcc
0
 

Author Closing Comment

by:Jeff_Kingston
ID: 36716160
Thanks for the direction.. seems pretty straight forward
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Crystal Reports 2008 6 45
Crystal Reports condense field in detail section when null without formula 2 69
Sum Before Standard Deviation 2 35
Count If in Crystal Reports 2 32
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question