Office中国论坛/Access中国论坛

标题: 样控制报表的打印边距和纸型啊 [打印本页]

作者: eastport    时间: 2004-9-28 19:50
标题: 样控制报表的打印边距和纸型啊
怎样控制报表的打印边距和纸型啊,VBA怎么写啊,请指教
作者: wang1999    时间: 2004-9-29 01:17
利用Printer 对象的ColorMode、Copies、Duplex、Orientation、PaperBin、PaperSize 属性设置应该基本满足要求!

你具体在帮助文档中详细看一看。

此为OFFICE-XP新增对象,2K无法使用.但如果要使用VBA加载自定义纸张,这个比较麻烦,代码十分复杂,要基本用到下列API函数,不推荐使用,除非你开发商业化软件Public Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesA" _

                (ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex As Long, _

                lpOutput As Any, lpDevMode As Any) As LongPublic Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" _

                (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As LongPublic Declare Function EnumForms Lib "winspool.drv" Alias "EnumFormsA" _

                (ByVal hPrinter As Long, ByVal Level As Long, ByRef pForm As Any, _

                ByVal cbBuf As Long, ByRef pcbNeeded As Long, _

                ByRef pcReturned As Long) As LongPublic Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" _

                (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long) As LongPublic Declare Function ClosePrinter Lib "winspool.drv" _

                                     (ByVal hPrinter As Long) As LongPublic Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _

                              (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
作者: quanli    时间: 2004-9-29 18:48
Dim stDocName As String

Dim prt As Printer

Set prt = Application.Printers(0)

prt.Orientation = acPRORLandscape

prt.BottomMargin = 800

prt.TopMargin = 1400

prt.LeftMargin = 700

prt.RightMargin = 400

prt.PaperSize = acPRPSA4stDocName = "一览表"

DoCmd.OpenReport stDocName, acPreview

Reports(stDocName).Printer = prt




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3