适用于

Application 对象

Form 对象

Report 对象

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

表达式.Printer

表达式 必需。 返回"适用对象"列表中的一个对象的表达式。

示例

以下示例使“打印机”集合中的第一个打印机成为系统的默认打印机,然后报告其名称、驱动程序信息和端口信息。

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

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Office Insiders

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?

Thank you for your feedback!

×