borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (printing w/ resize & child windows)Next Topic (help in deducting certain amount whenever a new paydate is entered) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Advanced Printer Properties
Poster Message
jesusrice
Level: Trainee

Registered: 23-02-2005
Posts: 1

icon 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]

23-02-2005 at 05:46 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : Advanced Printer Properties
Previous Topic (printing w/ resize & child windows)Next Topic (help in deducting certain amount whenever a new paydate is entered) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder