[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Set Page Orientation using Crystal Reports in VB6

Posted on 2001-08-06
7
Medium Priority
?
2,510 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
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 600 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month19 days, 19 hours left to enroll

872 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