Private Sub Command1_Click()
Dim beginpage, endpage, numcopies, orientation, i
CommonDialog1.CancelError = True
On Error GoTo errhandler
CommonDialog1.ShowPrinter
beginpage = CommonDialog1.FromPage
endpage = CommonDialog1.ToPage
numcopies = CommonDialog1.Copies
orientation = CommonDialog1.orientation
For i = 1 To numcopies
Next
Exit Sub
errhandler:
Exit Sub
end sub
Sub Print1(ByVal sTableHead As String, ByVal iPrintRows As Integer, ByVal iPrintCols As Integer)
Dim StartX As Integer, StartY As Integer, StartX_Const As Integer, StartY_Const As Integer
Dim RowsOfPage As Integer, CurrentPageNo As Integer, CurrentRowsNo As Integer
Dim RowsNo As Integer, ColsNo As Integer
Dim TableWidth As Integer, RowWidth As Integer, ColWidth As Integer
Dim Font As Integer
Dim PageFoot As String
Else
StartY = StartY + RowWidth
End If
Next RowsNo
'以下在最后一页剩余划空行
If CurrentRowsNo < RowsOfPage Then
For RowsNo = CurrentRowsNo To RowsOfPage
Printer.Line (StartX_Const - 50, StartY - 30)-(StartX_Const - 50 + TableWidth, StartY - 30)
StartY = StartY + RowWidth
Next RowsNo
End If
'以下打印最后一页中的页脚
PageFoot = "第" + CStr(CurrentPageNo) + "页"
prnt1 StartX_Const + iPrintCols * ColWidth - 1000, StartY - 30 - RowWidth + 30, 12, PageFoot
StartX = StartX_Const
'以下打印最后一页中的竖线
For ColsNo = 0 To iPrintCols
Printer.Line (StartX - 50, StartY_Const - 30)-(StartX - 50, StartY - RowWidth - 30)
StartX = StartX + ColWidth
Next ColsNo
Printer.EndDoc '打印结束
End Sub
'打印内容的子程序
Function prnt1(ByVal X As Integer, ByVal Y As Integer, ByVal Font As Single, ByVal txt As String)
Printer.CurrentX = X
Printer.CurrentY = Y
Printer.FontBold = False
Printer.FontSize = Font
Printer.Print txt
End Function