Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Set Page Orientation using Crystal Reports in VB6

Posted on 2001-08-06
Last Modified: 2012-06-27
Hi all,
I'm using VB6, with Crystal Reports version 4.6.
Is there a way to set the page orientation from the VB code?

The vb program is accessing SQL7.0 tables, then using the call

  crystal.action = 1

to open up the print preview screen.  The page orientation always comes up with whatever the orientation is for the user's default printer.
I've allowed the printer setup box to be available so the user can manually change the orientation, but I would like to have it automatically change to landscape, since the report is made in landscape style.

Any suggestions?
Question by:CraigEng
  • 3
  • 2
  • 2
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6357726
Have you tried setting the Printer Orientation property?

Author Comment

ID: 6357761
To acperkins,

I'm not sure where you mean to set this property.  I've been looking in the custom properties of the crystal reports control, but it doesn't have any orientation...
Do you mean to set it using something other than the crystal control?   I'm not sure how to do this (if that is what you meant...)

LVL 75

Expert Comment

by:Anthony Perkins
ID: 6357904
My idea was for you to set the Orientation for the Printer object to see if that would change the default printer.  But it has been a while since I used Crystal reports and I have no idea if this works.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 12

Expert Comment

ID: 6358023
See list of additional info at bottom.  You have to set both the CRW orientation and the printer orientation if you are printing directly to the printer.  This code sets the CRW orientation (there are other ways to do it depending on your version and technique)

Dim crpApp As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpPageSetup As CRPEAuto.PageSetup

Set crpApp = CreateObject("Crystal.CRPE.Application")
Set crpReport = crpApp.OpenReport("C:\test\myreport.rpt")
Set crpPageSetup = crpReport.PageSetup

' Use any one of the following three constants to set the appropriate orientation

' crpPageSetup.PageOrientation = crDefauttPaperOrientation
' crpPageSetup.PageOrientation = crPortrait
' crpPageSetup.PageOrientation = crLandscape

These links may be helpful:


Author Comment

ID: 6403179
Thanks for the input DRRYAN3, (sorry to take so long to comment)

These solutions seem to be for Crystal Version 5 or higher.  I'm wondering if I'm missing something, since the installation from the VB6 disk only gives Crystal 4.6.  I looked on the Crystal site from the links you provided, but I wasn't able to see any way to upgrade.

I'm guessing the page orientation can't be set in Version 4.6.

LVL 12

Accepted Solution

DRRYAN3 earned 200 total points
ID: 6406485

The upgrade is not free, but is well worth the money if you are doing any development work with CRW.  

If these properties are not available in your current version of Crystal Reports, you will most likely have to set the page orientation at report design time in the designer.  Not being familiar with CR 4.6, you may also find it necessary to set the properties for the default printer prior to printing.


Author Comment

ID: 6407485
Thanks for your input and time.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 180
SLMGR Switches Are Not Working On KMS Host 3 107
using web browser with BING 40 130
Publisher:   Unknown     VB.exe Application 1 27
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question