I am writing a VB app that provides the user with a menu of reports written in Crystal Reports 4.6. When the user selects a report, it is shown in the Crystal Reports preview window from where it can be printed to the selected printer.
My problem is that the page orientation is derived from the printer, not the report. I need the orientation to be portrait or landscape depending on the report selected, not the printer. If the selected printer is set up as portrait but the report is landscape, I need it to print in landscape (and vice versa). I don't want the user to have to touch the printer setup.
I have found the following code segment that looks like it might be a solution:
Dim repApp As CRAXDRT.Application Dim cryReport As CRAXDRT.Report Set cryReport = repApp.OpenReport(strRptName, 1) 'where strRptName has been set up as the report name cryReport.PaperOrientation = crLandscape
However, it gives me a "User-defined type not defined" error on compile. I need to know how to make it work so that I can test it. Or if you don't think it's the solution I need, perhaps you have some other suggestions?