Function PrintReport(strReportName As String, lngTopMagin As Long, lngLeftMagin As Long)
'===================================================================
'进行打印设置
'===================================================================
On Error GoTo me_error
Dim prt As Printer
Set prt = Application.Printers(0)
prt.PaperSize = acPRPSA3
prt.TopMargin = lngTopMagin * 567 / 10 '单位为mm
prt.LeftMargin = (lngLeftMagin - 20) * 567 / 10 '单位为mm
[code]Type str_DEVMODE
RGB As String * 94
End Type
Type type_DEVMODE
strDeviceName As String * 16
intSpecVersion As Integer
intDriverVersion As Integer
intSize As Integer
intDriverExtra As Integer
lngFields As Long
intOrientation As Integer
intPaperSize As Integer
intPaperLength As Integer
intPaperWidth As Integer
intScale As Integer
intCopies As Integer
intDefaultSource As Integer
intPrintQuality As Integer
intColor As Integer
intDuplex As Integer
intResolution As Integer
intTTOption As Integer
intCollate As Integer
strFormName As String * 16
lngPad As Long
lngBits As Long
lngPW As Long
lngPH As Long
lngDFI As Long
lngDFr As Long
End Type
Public Sub CheckCustomPage(ByVal rptName As String)
' 用 途:检查报表的自定义纸张
' 调用方法:Call CheckCustomPage(rptName)
' 参数说明:rptName: 为检查的报表名称
' 调用举例:设有名为"MyReport"的报表,
' Call CheckCustomPage("MyReport")
' 当该报表使用的是自定义纸张时,则显示自定义纸张的大小,
' 并询问是否更改纸张的大小并进行设置;
' 当该报表使用的是标准纸张时,则询问是否使用自定义纸张,
' 如果选择“是”,则要求输入纸张的大小并进行设置。
Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report
Dim intResponse As Integer
' 在设计视图下打开报表
DoCmd.OpenReport rptName, acDesign
Set rpt = Reports(rptName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode