Specifiying the name of a Crystal Report being exported out of a VB project to Email.

I have a VB app Using Crystal 8.5 Developer to run and then export a report to mail addresses. Currently the name of the exported file is a number. How do I specifiy what I want the exported reports file name to be? And is it possible to name it the current date?

                        crptWeeklyBriefing.ExportOptions.DestinationType = crEDTEMailMAPI
                        crptWeeklyBriefing.ExportOptions.MailToList = "MyName@Yahoo.com"
                        crptWeeklyBriefing.ExportOptions.MailSubject = "Daily Briefing Report"
                        crptWeeklyBriefing.ExportOptions.MailMessage = _
                           "Attached please find the Daily Briefing Report. "
                        crptWeeklyBriefing.ExportOptions.FormatType = crEFTPortableDocFormat
                        crptWeeklyBriefing.Export (False)
DavidNPDAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
I believe you will have to actually export it to a disk file then send it through mail.  Crystal doesn't use the diskfilename unless it creates a permanent file.

mlmcc
0
 
vidruCommented:
crptWeeklyBriefing.ExportOptions.DiskFileName = "YourFileName.pdf"

To save it with the date as the file name, make sure that the date is in a valid format for a file name:

crptWeeklyBriefing.ExportOptions.DiskFileName = Format(Date, "MM-DD-YYYY") & ".pdf"

-dave
0
 
DavidNPDAuthor Commented:
I put this code in but it doesnt seem to make any difference, no errors but the file comes in the email named "241.pdf" and then the second time i tried 291.pdf.

0
 
vidruCommented:
Whoops, shoud've tested that first...

As mlmcc stated, that will only work if actually exporting to disk, then attaching the file.

-dave
0
 
mlmccCommented:
Glad i could help

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.