Solved

Help Me, Printing Problem

Posted on 1999-01-06
2
195 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

713 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