Home > BSPrinter documentation > Reference

SelectPrinter Method

Applies to: PrintPreview control , IPrinterEx object

Return Type: Boolean
In          Required          DeviceName          As String
In          Optional          PreserveUserPrintingPreferences          As Boolean          Default value: False


It selects a printer.

Parameters explained:

DeviceName: device to select.

PreserveUserPrintingPreferences: if True, the current printing settings such as Orientation, PaperSize, ColorMode will be preserved is the driver supports them. If the paper size is not supported by the printer, it will select the most similar paper. If False the settings will be printer default settings. The default value is False

It returns True if the printer was successfully selected, False otherwise.
The reason why a printer selection can fail is because the printer doesn't exists or because DeviceName was misspelled.

Note: it is similar to the code:

    Dim prn As Printer
    For Each prn In Printers
        If prn.DeviceName = DeviceName Then
            Set Printer = prn
            Exit For
        End If

See Also:

PrinterExists method.