Printer 属性

       

返回或设置代表当前系统上默认打印机的 Printer 对象。可读写。

expression.Printer

expression   必需。返回“Applies To”列表中的一个对象的表达式。

示例

下面的示例将 Printers 集合中的第一个打印机设为系统的默认打印机,然后报告其名称、驱动程序信息以及端口信息。

Dim prtDefault As Printer

Set Application.Printer = Application.Printers(0)

Set prtDefault = Application.Printer

With prtDefault
    MsgBox "Device name: " & .DeviceName & vbCr _
        & "Driver name: " & .DriverName & vbCr _
        & "Port: " & .Port
End With