Set the printer orientation


Declare Function Escape Lib "GDI" (ByVal hDC As Integer,
    ByVal nEscape As Integer,
    ByVal nCount As Integer,
    lplnData As Any,
    lpOutData As Any) As Integer

Const Portrait = 1
Const LandScape = 2
Const GetSet = 30

Dim Retval As Integer
Dim CurOrnt As Integer
Dim Ornt As Integer

'get current rotation, if not landscape change it and save

    CurOrnt = Escape(printer.hDC, GetSet, 0, Null, 0)
    If (CurOrnt <> LandScape) Then
      Ornt = LandScape

      Retval = Escape(printer.hDC, GetSet, Len(ornt), ornt, Null)
      printer.EndDoc
    End If

'restore when exit

    If (CurOrnt <> Ornt) Then
      Ornt = CurOrnt
      Retval = Escape(printer.hDC, GetSet, Len(ornt), ornt, Null)
      printer.EndDoc
    End If

End Function



Mail to Daniel Wiman <daniel@wimania.com>
Online since June 1996, updated 980315
<- The VB home
<- Daniels homepage