Solved

Help Me, Printing Problem

Posted on 1999-01-06
2
197 Views
Last Modified: 2012-08-13
Can anyone tell me if there is a way to force a print to come out in Landscape instead of Portrait. I'm Using Crystal Report Activex Control in V.B 5.0 and can't print in Landscape Orintation when the defaul orintation is Portrait
0
Comment
Question by:diego_mendoza
[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
2 Comments
 

Accepted Solution

by:
torsk earned 100 total points
ID: 1454175
I think you have to start the report whith code:

Public Sub OpenTheReport( ByRef CurrentFrm As Form)
On Error GoTo ErrorHandler
    Dim Result%, jobnum%, mainjob%, dialogflag%, resultlong&
    Dim JobInfo As PEJobInfo, TempText$
    Dim PrintData As Printer
    Dim crDEVMODE As DevMode
    Dim HasSavedData As Long
    Dim PrintOptions As PEPrintOptions
    Dim Msg As String
       
    Result% = PEOpenEngine()
    If Result% = 0 Then
        HourGlass False
        MsgBox "Cant get conntact with Crystal Report!",
        vbOKOnly + vbCritical, "Systemerror"
        Exit Sub
    End If

    JobInfo.StructSize = PE_SIZEOF_JOB_INFO
    jobnum% = PEOpenPrintJob("RepeortFilename")
       
    crDEVMODE.dmOrientation = 1 'or 2 this change the
                                 orientation
    crDEVMODE.dmDeviceName = "RptDeviceName"   'printername
    crDEVMODE.dmSpecVersion = &H320 'version of the DEVMODE
                               structure Win32
    crDEVMODE.dmSize = 68                              
    crDEVMODE.dmFields = &H1
    Result% = PESelectPrinter(jobnum%, "DriverName",
    "DeviceName", "Port", crDEVMODE)
   
    PrintOptions.StructSize = PE_SIZEOF_PRINT_OPTIONS
    Result% = PEGetPrintOptions(jobnum%, PrintOptions)
    PrintOptions.StartPageN = Rpt.RptFraSide
    PrintOptions.stopPageN = Rpt.RptTilSide
    PrintOptions.nReportCopies = Rpt.RptKopier
    Result% = PESetPrintOptions(jobnum%, PrintOptions)
   
    If Rpt.RptPreview Then  
        Result% = PEOutputToWindow(jobnum%, Rpt.RptTittel, 0, 0, Screen.Width, Screen.Height, WS_MAXIMIZE + WS_SYSMENU + WS_MAXIMIZEBOX + WS_THICKFRAME, 0)
        Result% = PEStartPrintJob(jobnum%, True)       uforutsette resultater
       
        If Result% = 0 Then
            Msg = "Error"
            ShowErrMsg (Msg)
            GoTo Avslutt
        End If
       
        Result% = 1
        Do While Result% <> 0
            DoEvents
            Result% = PEGetWindowHandle(jobnum%)
        Loop
    Else                    
        Result% = PEEnableProgressDialog(jobnum%, True)
        Result% = PESetDialogParentWindow(jobnum%, CurrentFrm.hwnd)
        Result% = PEOutputToPrinter(jobnum%, Rpt.RptKopier)
        Result% = PEStartPrintJob(jobnum%, True)            

        Result% = PEGetJobStatus(jobnum%, JobInfo)
        Select Case Result%
            Case PE_JOBNOTSTARTED
                TempText$ = "Cant start"
            Case PE_JOBINPROGRESS
                TempText$ = "Printing"
            Case PE_JOBCOMPLETED
                TempText$ = "Printing ready"
            Case PE_JOBFAILED
                TempText$ = "Error"
            Case PE_JOBCANCELLED
                TempText$ = "Cancel printing"
        End Select
       
        If Result% <> PE_JOBCOMPLETED Then MsgBox TempText, vbInformation + vbOKOnly
       
    End If
       
    GoTo Avslutt
   
ErrorHandler:
    HourGlass False
    ShowErrMsg
Avslutt:
    PEClosePrintJob jobnum%
    PECloseEngine
    HourGlass False
End Sub
0
 

Author Comment

by:diego_mendoza
ID: 1454176
Thanks you.


0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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 Month10 days, 15 hours left to enroll

628 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