Results 1 to 1 of 1

Thread: Printer.Duplex - network printer problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    3

    Printer.Duplex - network printer problem

    I am having a problem that is driving me mad. Attempting to add a printer setup dialog to an application, however on certain network printers I cannot set Printer.Duplex to printDlg.Duplex.
    It does work on some of the printers but not on others.
    The network is WindowsXP and most of the printers are on the same server. I'm sure that many will recognize the code below, as it's the same code that exists on many of VB help forumns.

    Private Sub UserPrinterSelect()
    Dim NewPrinterName As String
    Dim objPrinter As Printer
    Dim strsetting As String

    Dim printDlg As PrinterDlg
    Set printDlg = New PrinterDlg

    ' Set the starting information for the dialog box based on the current printer settings.
    printDlg.PrinterName = Printer.DeviceName
    printDlg.DriverName = Printer.DriverName
    printDlg.Port = Printer.Port
    printDlg.Copies = Printer.Copies
    printDlg.Orientation = Printer.Orientation
    printDlg.PaperBin = Printer.PaperBin



    printDlg.Flags = cdlPDPrintSetup
    Printer.TrackDefault = False


    If Not printDlg.ShowPrinter(Me.hwnd) Then
    Debug.Print "Cancel Selected"
    Exit Sub
    End If


    ' Locate the printer that the user selected in the Printers collection.
    NewPrinterName = UCase$(printDlg.PrinterName)
    If Printer.DeviceName <> NewPrinterName Then
    For Each objPrinter In Printers
    If UCase$(objPrinter.DeviceName) = NewPrinterName Then
    Set Printer = objPrinter
    End If
    Next
    End If

    ' Copy user input from the dialog box to the properties of the selected printer.
    Printer.Copies = printDlg.Copies
    Printer.Orientation = printDlg.Orientation
    Printer.Duplex = printDlg.Duplex


    I also have tried:
    Printer.Duplex = 1
    Printer.Duplex = 2
    Printer.Duplex = 3
    All the values are valid but only 1 is accepted by the Print object.

    I know that there has to be a way for me to set this property. I can do whatever I want in Word and Excel and it works.

    Any ideas would be greatly appreciated... (and please keep it simple.. old programmer, new to VB)
    Last edited by MARK98115; Oct 1st, 2004 at 11:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width