適用對象

應用程式物件

Form 物件

Report 物件

傳回或設定代表目前系統上預設印表機的 Printer 物件。 讀/寫。

expression.Printer

表達 必要。 一個運算式,該運算式會返回應用程式至清單中的其中一個物件。

範例

以下範例將 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

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!

×