|
问题:无法在页面设置中更改页边距
函数如下:
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
DoCmd.OpenReport strReportName, acPreview
With Reports(strReportName).Printer
.PaperSize = prt.PaperSize
.TopMargin = lngTopMagin * 567 / 10
.LeftMargin = (lngLeftMagin - 20) * 567 / 10
End With
'DoCmd.PrintOut acPages, 1, 1, , 1
' 关闭报表并保存
DoCmd.Close acReport, strReportName, acSaveYes
myerror:
Exit Function
me_error:
MsgBox "错误代号:" & err.number & Chr(13) & "错误提示:" & err.Description, vbCritical, "错误"
Resume myerror
End Function |
|