如何控制vba打印机走纸?
我自己用VBA设计了收学费打印凭证,想实现电脑打印,可是,如何才能一个一个凭证自动分开打印呢?(凭证是大小是14*8cm)
我用Excel的VBA实现了一个打印工资条的程序,程序是从工资表中抽取出相关数据后然后复制到工资条对应的单元格中,程序代码如下:
Private Sub dayin_Click()
Dim baobiao As Object
Set baobiao = Workbooks( "正常情况.xls ").Worksheets( "打印 ")
Dim a As Integer
a = 1
For a = 1 To 2
baobiao.Range( "a5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,3,TRUE) "
baobiao.Range( "b5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,4,TRUE) "
baobiao.Range( "c5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,5,TRUE) "
baobiao.Range( "d5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,6,TRUE) "
baobiao.Range( "e5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,7,TRUE) "
baobiao.Range( "f5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,8,TRUE) "
baobiao.Range( "g5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,9,TRUE) "
baobiao.Range( "h5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,10,TRUE) "
baobiao.Range( "i5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,11,TRUE) "
baobiao.Range( "j5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,12,TRUE) "
baobiao.Range( "k5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,13,TRUE) "
baobiao.Range( "l5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,14,TRUE) "
baobiao.Range( "m5 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,15,TRUE) "
baobiao.Range( "b8 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,16,TRUE) "
baobiao.Range( "c8 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,18,TRUE) "
baobiao.Range( "d8 ").Formula = "=VLOOKUP( " & a & ",正常情况!A2:T780,19,TRUE) "
baobiao.Range( "e8 ").Formula = "=M5-B8-C8-D8 "
baobiao.Range( "h8 ").Formula = "=e8 "
baobiao.Range( "a1:m9 ").PrintOut 1, 1
Next
End Sub
这段程序运行的实际情况是,每次循环打印出一工资条之后,打印机会自动换纸,在VBA中应当怎样做才能使两次打印循环出两张工资条打印于同一张纸上。
那就一个一个打印咯.