Publisher) (Printer 物件
Printer 物件代表電腦上已安裝的印表機。
註解
Printer物件的許多屬性,例如PaperSize、PaperSource和PaperOrientation,會對應至 Microsoft Publisher 使用者介面中 [檔案] 功能表 ([列印設定] 對話方塊中的設定) 。
所有已在電腦上安裝的印表機集合是由 InstalledPrinters 集合表示。
範例
下列 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 PrinterName 與 印表機 要取得之物件所有已安裝的印表機的清單在電腦上, IsActivePrinter 屬性決定何種它們是目前使用中印表機並取得使用中印表機的設定的部分。 巨集在 [ 即時運算] 視窗中顯示結果。
Public Sub Printer_Example()
Dim pubInstalledPrinters As Publisher.InstalledPrinters
Dim pubApplication As Publisher.Application
Dim pubPrinter As Publisher.Printer
Set pubApplication = ThisDocument.Application
Set pubInstalledPrinters = pubApplication.InstalledPrinters
For Each pubPrinter In pubInstalledPrinters
Debug.Print pubPrinter.PrinterName
If pubPrinter.IsActivePrinter Then
Debug.Print "This is the active printer"
Debug.Print "Paper size is ", pubPrinter.PaperSize
Debug.Print "Paper orientation is ", pubPrinter.PaperOrientation
Debug.Print "Paper source is ", pubPrinter.PaperSource
End If
Next
End Sub
屬性
- Application
- DriverType
- Index
- IsActivePrinter
- IsColor
- IsDuplex
- PaperHeight
- PaperOrientation
- PaperSize
- PaperSource
- PaperWidth
- Parent
- PrintableRect
- PrinterName
- PrintMode
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。