一個 Printer 對象對應(yīng)系統(tǒng)中的一臺可用打印機。
Printer 對象是 Printers 集合的成員。
若要返回對 Printers 集合中單個 Printer 對象的引用,可以使用下列任何一種語法格式:
語法 |
說明 |
Printer s!devicename |
devicename 參數(shù)是由 DeviceName 屬性返回的 Printer 對象的名稱。 |
Printer s("devicename") |
devicename 參數(shù)是由 DeviceName 屬性返回的 Printer 對象。 |
Printer s(index) |
index 參數(shù)是對象在集合中的序號位置。有效范圍從 0 到 Printers.Count-1。 |
可以使用 Printer 對象的這些屬性,為系統(tǒng)中的可用打印機設(shè)置打印特征。
使用 ColorMode、Copies、Duplex、Orientation、PaperBin、PaperSize 和 PrintQuality 屬性可以指定某個特定打印機的打印設(shè)置。
使用 LeftMargin、RightMargin、TopMargin、BottomMargin、ColumnSpacing、RowSpacing、DataOnly、DefaultSize、ItemLayout、ItemsAcross、ItemSizeHeight 和 ItemSizeWidth 屬性可以指定 Microsoft Access 應(yīng)該如何設(shè)置打印頁上的數(shù)據(jù)外觀格式。
使用 DeviceName、DriverName 和 Port 屬性可以返回有關(guān)某個特定打印機的系統(tǒng)信息。
下面的示例顯示有關(guān) Printers 集合中第一個打印機的系統(tǒng)信息。
Dim prtFirst As Printer
Set prtFirst = Application.Printers(0)
With prtFirst
MsgBox "Device name: " & .DeviceName & vbCr _
& "Driver name: " & .DriverName & vbCr _
& "Port: " & .Port
End With