适用于
|
Application 对象 |
|
Form 对象 |
|
Report 对象 |
返回或设置表示当前系统上的默认打印机的 Printer 对象。 可读/写。
表达式.Printer
表达式 必需。 返回“适用范围”列表中的对象之一的表达式。
示例
以下示例使“打印机”集合中的第一个打印机成为系统的默认打印机,然后报告其名称、驱动程序信息和端口信息。
Dim prtDefault As PrinterSet Application.Printer = Application.Printers(0)Set prtDefault = Application.PrinterWith prtDefault MsgBox "Device name: " & .DeviceName & vbCr _ & "Driver name: " & .DriverName & vbCr _ & "Port: " & .PortEnd With