'************************************************************** '* 名称:VouchPrint '* 功能:记录打印函数 '* 传入参数: '* 返回参数: '* 作者: '* 新建日期:2002-10-02 23:35:40 '*最新修改日期:2002-10-02 23:35:40 '************************************************************** Private Sub VouchPrint() On Error GoTo PrintErr: Dim PrnUnit As Double '设置打印单位
Dim fHead_Top As Double '表头上边距 Dim fHead_Left As Double '表头左边距 Dim fBody_Top As Double '表体上边距 Dim fBody_Left As Double '表体左边距 Dim fBottom_Top As Double '表尾上边距 Dim fBottom_Left As Double '表尾左边距 Dim fVouchHight As Double '单据高度 Dim fVouchWidth As Double '单据宽度
'* 名称:VouchPrint
'* 功能:记录打印函数
'* 传入参数:
'* 返回参数:
'* 作者:
'* 新建日期:2002-10-02 23:35:40
'*最新修改日期:2002-10-02 23:35:40
'**************************************************************
Private Sub VouchPrint()
On Error GoTo PrintErr:
Dim PrnUnit As Double '设置打印单位
Dim fHead_Top As Double '表头上边距
Dim fHead_Left As Double '表头左边距
Dim fBody_Top As Double '表体上边距
Dim fBody_Left As Double '表体左边距
Dim fBottom_Top As Double '表尾上边距
Dim fBottom_Left As Double '表尾左边距
Dim fVouchHight As Double '单据高度
Dim fVouchWidth As Double '单据宽度
fHead_Top = 2
fHead_Left = 10
fBody_Top =50
fBody_Left = 10
fBottom_Top = 100
fBottom_Left =10
fVouchHight =100
fVouchWidth = 300
'1毫米=0.03937英寸
'1英寸=1440提(twips)
'A4纸=197毫米*210毫米
PrnUnit = 0.03937 * 1440 '设置最小打印单位
'Printer.PaperSize = vbPRPSUser '用户自定义打印纸张大小
Printer.Width = fVouchWidth * PrnUnit '初始化打印纸的宽度
Printer.Height = fVouchHight * PrnUnit '初始化打印纸的高度 Printer.ScaleWidth = fVouchWidth * PrnUnit
Printer.ScaleHeight = fVouchHight * PrnUnit
Printer.FontSize = 10
'设置打印字体大小
'---------- 打印内容 ----------
'\\start****************************************************************
'日期
Printer.CurrentX = (fHead_Left + 45) * PrnUnit '打印机X起始位置定位
Printer.CurrentY = (fHead_Top + 5) * PrnUnit '打印机Y起始位置定位
Printer.Print date()
'单据号
Printer.CurrentX = (fHead_Left + 88) * PrnUnit
Printer.CurrentY = (fHead_Top + 5) * PrnUnit
Printer.Print "电脑号码:" & Trim(txtcVouchID.Text)
'客户名称
Printer.CurrentX = (fHead_Left + 152) * PrnUnit
Printer.CurrentY = (fHead_Top + 5) * PrnUnit
Printer.Print Trim(txtcCusName.Text)
Printer.EndDoc '开始把上述输出送给打印机
MousePointer = 0
Exit Sub
PrintErr:
MousePointer = 0
MsgBox "打印错误,错误原因为:" & Err.Description, vbExclamation, 48, "提示"
Exit Sub
End Sub