vb6.0实时错误381:下标越限
本人新手上路,想编个请帖,碰到问题,请高手指点。以下是代码:(MS1、MS2是MSHFlexGrid1控件)
Private Sub Command1_Click() '横排打印
Dim i, j, n As Integer
Dim ch As String
'
Printer.PaperSize = 9 '设置纸张类型为A4
Printer.ScaleMode = 6 '设置计量单位为毫米
Printer.FontName = "宋体"
Printer.FontSize = 16
Printer.FontBold = False
'
For i = 1 To MS1.Rows
For j = 1 To MS2.Rows
Printer.CurrentX = Val(MS2.TextMatrix(j, 4))
Printer.CurrentY = Val(MS2.TextMatrix(j, 5))
Printer.FontName = MS2.TextMatrix(j, 6)
Printer.FontSize = Val(MS2.TextMatrix(j, 7))
Printer.FontBold = MS2.TextMatrix(j, 8)
Printer.Print MS2.TextMatrix(j, 3)
Next
Printer.FontName = Text1(2).Text
Printer.FontSize = Val(Text1(3).Text)
Printer.FontBold = Text1(4).Text
Printer.CurrentX = Val(Text1(0).Text)
Printer.CurrentY = Val(Text1(1).Text)
Printer.Print MS1.TextMatrix(i, 2)
Printer.CurrentX = Val(Text1(0).Text) + 30
Printer.CurrentY = Val(Text1(1).Text)
Printer.Print MS1.TextMatrix(i, 3)
Printer.NewPage
Next
Printer.EndDoc
Exit Sub
End Sub