会员登录 - 用户注册 - 网站地图 Office中国(office-cn.net),专业Office论坛
当前位置:主页 > 技巧 > Access技巧 > 模块函数VBA > 正文

页面设置模块代码分享

时间:2006-11-24 23:43 来源:网络 作者:佚名 阅读:
Dim up, dn, le, ri, si, liAs Single , co As string'定义边距及页面函数
Sub ymszmk(strName As String) '页面设置模块On Error GoTo Err_ymszmkIf Nz(DCount("*", "REPORTLIP", "REPORT='" & strName & "'")) = 0 ThenMsgBox "没有此报表的页面设置,请设置", , "提示"Exit SubEnd Ifup = DLookup("REUP", "REPORTLIP", "REPORT='" & strName & "'")dn = DLookup("REDOWN", "REPORTLIP", "REPORT='" & strName & "'")le = DLookup("RELEFT", "REPORTLIP", "REPORT='" & strName & "'")ri = DLookup("RERIGHT", "REPORTLIP", "REPORT='" & strName & "'")li = DLookup("RECOL", "REPORTLIP", "REPORT='" & strName & "'")si = DLookup("RESIZE", "REPORTLIP", "REPORT='" & strName & "'")co = IIf(DLookup("RECOURES", "REPORTLIP", "REPORT='" & strName & "'") Like "横向", acPRORLandscape, acPRORPortrait)Dim prt As Printer
    Set prt = Application.Printers(0)
prt.TopMargin = up * 56.7     '上prt.BottomMargin = dn * 56.7  '下prt.LeftMargin = le * 56.7    '左prt.RightMargin = ri * 56.7   '右prt.ItemsAcross = li          '列prt.PaperSize = si            '大小prt.Orientation = co
DoCmd.OpenReport strName, acPreviewReports(strName).Printer = prt
Exit_Err_ymszmk:    Exit Sub
Err_ymszmk:    If Err = 5 Then    MsgBox "没有打印机,请先安装打印机!", , "提示"    Exit Sub    End If    MsgBox Err.Description    Resume Exit_Err_ymszmkEnd Sub

(责任编辑:admin)

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价: