DriverName, DeviceName, PortName Properties (Printer)

Purpose

Returns the name of the driver for a Printer object, the name of the device a driver supports, and the name of the port through which a document is sent to a printer.

Syntax

Printer.DeviceName
Printer.DriverName
Printer.PortName

Description

Each driver has a unique name. For example, the DriverName for several of the Hewlett-Packard printers is HPPCL5MS. The DriverName is typically the driver's filename without an extension.

The DeviceName property contains the name of the device the driver supports. For Example, "PCL/HP LaserJet" is the name of one driver. You can use this to indicate the printer you're printing on.

The PortName returns the name of the port which is determined by the operating system determines, such as LPT1: or LPT2:.

Example

Ocx CommDlg cd

cd.Flags = 0

cd.ShowPageSetup

Set Printer = cd

Debug.Show

Trace cd.DevNames

Trace Printer.DeviceName

Trace Printer.DriverName

Trace Printer.PortName

Remarks

The properties of the Printer object initially match those of the default printer set in the Windows Control Panel.

See Also

Printer, ShowPageSetup, ShowPrint, SetPrinterByName

{Created by Sjouke Hamstra; Last updated: 03/10/2014 by James Gaite}