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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB ExportOptions Object 1

Status
Not open for further replies.

wheelek2

IS-IT--Management
Jan 9, 2001
1
US
How do you code the exportoption object to send a Crystal Reports 8 report to an HTML file?
 
I use the RDC component (I think that's what its called) and I've included code that I used for one of my applications. I use RTF format but you can use the intellisense option in VB to alter some of your properties. Also, my reports are built off stored procedures and I use parameters (you will see below). You can put this code into the click event of a button on a form in order to check it out.

good luck and I hope this helps.

bye
Jim

CODE BELOW:


'you have to add a reference to the Crystal 8.0 Object
'Library from Project--References menu (I forget the exact name of the .dll(s) you have to reference but include the whole library and then figure that out.
''i use the


Dim crxApplication As New CRAXDRT.Application
Dim Report As CRAXDRT.Report

Set Report = crxApplication.OpenReport(App.Path & "\" & sReportName, 1)

Report.Database.Tables.Item(1).SetLogOnInfo ODBCSource, databasename, userid, password

''if there are parameters then you will pass them like this:
Report.ParameterFields.Item(1).AddCurrentValue startdate
Report.ParameterFields.Item(2).AddCurrentValue enddate

'set up export options; you will changed to HTML type
''this is specified as rich text format
Report.ExportOptions.FormatType = crEFTRichText

''specify your destination; this saves the file to disk:
Report.ExportOptions.DestinationType = crEDTDiskFile

''since i save to disk you will have to provide and output
''location
Report.ExportOptions.DiskFileName = "c:\temp\output\tst.rtf"

'export the report without prompting the user
'this should start the export automatically; true value
''prompts user for save location (i think)
Report.Export False

''get rid of the object when done
Set Report = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top