Web Development

General discussion


crystal reports ran by vbscript

By wakin ·
I have searched many newsgroups and have not found an adequate answer to how a crystal report can be viewed/opened via vbscript. I have a report on a test web server and remote users can not get to it when I send a link to it via email. My vbscript needs to open the report, possibly export to a directory and then attach to an email. Code for email works great but I have tried getobject and createobject("CrystalReportRuntime.Application") and the script errors out at the line where either getobject or createobject is found. I need wisdom. Thank you.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by ftittaferrante In reply to crystal reports ran by vb ...

Hi Wakin,

The following code takes a filename of a Crystal Report and exports it to a PDF. It works with Crystal 8.5. I haven't tried it with anything else.


function ExportRPT( line )
dim rptfile, exportfile
dim RetValue
dim strDate
dim objCRRpt
dim objCRApp

WriteLog( "ExportRPT: " & line )

strDate = year(now()) & "-" & right("0" & month(now()),2) & "-" & right("0" & day(now()),2)

RetValue = ""

rptfile = UCase(line)
exportfile = Replace(rptfile, ".RPT", "-" & strDate & ".PDF")

Set objCRApp = CreateObject("CrystalRunTime.Application")
set objCRRpt = objCRApp.openreport( rptfile )

With objCRRpt
With .exportoptions
.formattype = crEFTPortableDocFormat
.PDFExportAllPages = true
.diskfilename = exportfile
.destinationtype = CrEDTDiskFile
.UseReportDateFormat = True
.UseReportNumberFormat = True
End With
RetValue = exportfile
End With
ExportRPT = RetValue
end function

Related Discussions

Related Forums