Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

schedule reprot export (file .rpt) to pdf

Status
Not open for further replies.

elly00

Technical User
Jun 30, 2011
69
0
0
IT
Hi,

it's possible using vbs to export a report (rpt file) to pdf?
I have this example

Set appl = CreateObject("CrystalRuntime.Application")
Set rep = appl.OpenReport("C:\test.rpt", 1)

rep.EnableParameterPrompting = False
rep.EnableParameterPrompting = False
rep.ExportOptions.DiskFileName = "C:\test.rtf"
rep.ExportOptions.DestinationType = 1
rep.ExportOptions.PDFExportAllPages = True
rep.ExportOptions.FormatType = 4
rep.Export False

but the error is "ActiveX cannot create object"


THANKS
 
Which Crystal Reports version are you using? You could use vbscript to run crystal reports on the earlier versions (circa 2005). This facility has not been available since 2008.

I'm quite sure it is just .net now so possibly try powershell. Just look on the net: there are lot of examples on how to do this.
 
Hi

my crystal report is ver. 11
I need to open rpt file and export data in pdf but I don't know how do that..
:(
 
And just to make absolutely sure - Crystal Reports 11 is installed and working fine on the same PC that you are trying to run the VBScript?
 
And the correct component that provides CrystalRuntime.Application is registered properly (it has been a long time since I used CR, so can't remember what it is called)? I think it is one or both of crystl32.ocx and crviewer.dll

 
yes..may be I don't know the correct syntax to use..
Do you have a little example that open a report?

Thanks
 
Your syntax is fine. It pretty much looks like the problem is the ActiveX control that you need to use.

I suspect that crviewer.dll is either missing or not properly registered. Try sarovinet's solution for fixing this from here
 
Hi

I don't know I have the same error on a different pc
May be I've to configure the db connection or something like that?

Strange that other people haven't do something like that :(
 
>Strange that other people haven't do something like that

I'd suggest that most people are not trying to run a 16 year old version of Crystal Reports!
Or to drive it from VBS, which is documented as being unsupported (the documentation said "It might work, but we don't support it", or something similar, as I recall)
And of those people for whom neither of the above apply, I'd suspect that most have the runtime libraries properly installed, which I am not sure that you do, and which is theoretically addressed in the posyt I linked to in my previous post. Did you try sarovinet's solution?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top