Solved

Set Page Orientation using Crystal Reports in VB6

Posted on 2001-08-06
7
2,407 Views
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?
thanks
CraigEng
0
Comment
Question by:CraigEng
[X]
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
  • 3
  • 2
  • 2
7 Comments
 
LVL 75

Expert Comment

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

Author Comment

by:CraigEng
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...)

Thanks,
CraigEng
0
 
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.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 12

Expert Comment

by:DRRYAN3
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:

http://support.crystaldecisions.com/kbase/c2006136.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
http://support.crystaldecisions.com/kbase/c2000383.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/wraptest.zip.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
0
 

Author Comment

by:CraigEng
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.

Thanks,
CraigEng
0
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 200 total points
ID: 6406485
CraigEng

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.

DRRYAN3
0
 

Author Comment

by:CraigEng
ID: 6407485
Thanks for your input and time.
CraigEng
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 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