jesusrice Level: Trainee
 Registered: 23-02-2005 Posts: 1
|
Advanced Printer Properties
I am using the following code to print a basic file using the printer.print command but when the code pulls up the printer properties and i got to advanced to change portrait/landscape stapling etc. it does not change any of that information. please help
Private Sub cmdPrintstmt_Click()
Dim BeginPage, EndPage, NumCopies, Orientation, i
Dim p As Printer
Dim s As String
For Each p In Printers
s = p.DeviceName
If Left(s, 5) = "canon" Then
Exit For
End If
Next
Set p = Printer
' Set Cancel to True.
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Display the Print dialog box.
CommonDialog1.ShowPrinter
' Get user-selected values from the dialog box.
BeginPage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
Orientation = CommonDialog1.Orientation
For i = 1 To NumCopies
Dim x As Long
UpdateStmtMsgs
Buf = " "
p.Print Buf
fDb.Open "dsn=CUDBSql"
If fDb.State <> adStateOpen Then
MsgBox "Can not open database=CudbSQL"
Exit Sub
End If
For x = 1 To highstmt
Sql = "select * from stmtmessages where inst=1 and numb = " & x
fRs.Open Sql, fDb, adOpenStatic, adLockReadOnly
If Not fRs.EOF Then
Buf = fRs.Fields("msg")
Else
Buf = " "
End If
Printer.FontSize = 10
Printer.Print Format(x, "##0") & " " & Buf
fRs.Close
Next x
Printer.EndDoc
fDb.Close
Next i
Exit Sub
ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
[Edited by jesusrice on 23-02-2005 at 05:46 PM GMT]
|