打印机对象 (Access)
一个 Printer 对象与系统中的一台可用打印机相对应。
备注
Printer 对象是打印机集合的成员。
若要返回对 Printers 集合中特定 Printer 对象的引用,可以使用下列任何一种语法格式:
语法 | 说明 |
---|---|
打印机!devicename | devicename 参数是由 DeviceName 属性返回的 Printer 对象的名称。 |
打印机 (“devicename”) | devicename 参数是由 DeviceName 属性返回的 Printer 对象的名称。 |
打印机 (索引) | index 参数是该对象在集合中的序号位置。 有效范围为 0 到 Printers.Count-1 。 |
使用 Printer 对象的属性设置系统上可用的任何打印机的打印特征。
使用 ColorMode、 Copies、 Duplex、 Orientation、 PaperBin、 PaperSize 和 PrintQuality 属性指定特定打印机的打印设置。
使用 LeftMargin、 RightMargin、 TopMargin、 BottomMargin、 ColumnSpacing、 RowSpacing、 DataOnly、 DefaultSize、 ItemLayout、 ItemsAcross、 ItemSizeHeight 和 ItemSizeWidth 属性可以指定 Microsoft Access 在打印页上应如何设置数据外观的格式。
使用 DeviceName、 DriverName 和 Port 属性可返回有关特定打印机的系统信息。
示例
下面的示例显示有关 Printers 集合中第一台打印机的系统信息。
Dim prtFirst As Printer
Set prtFirst = Application.Printers(0)
With prtFirst
MsgBox "Device name: " & .DeviceName & vbCr _
& "Driver name: " & .DriverName & vbCr _
& "Port: " & .Port
End With
属性
- BottomMargin
- ColorMode
- ColumnSpacing
- Copies
- DataOnly
- DefaultSize
- DeviceName
- DriverName
- Duplex
- ItemLayout
- ItemsAcross
- ItemSizeHeight
- ItemSizeWidth
- LeftMargin
- Orientation
- PaperBin
- PaperSize
- Port
- PrintQuality
- RightMargin
- RowSpacing
- TopMargin
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。