VB 打印 问题

Suba()c=InputBox("开始序号")b=InputBox("结束序号")Fori=cTo(b-c+1)Sheets("sheet1").Cells(2,8)=... Sub a()
c = InputBox("开始序号")
b = InputBox("结束序号")
For i = c To (b - c + 1)
Sheets("sheet1").Cells(2, 8) = Sheets("sheet1").Cells(2, 8) + 1
Sheets("sheet1").Cells(5, 2) = Sheets("sheet2").Cells(1 + i, 3)
Sheets("sheet1").Cells(6, 4) = Sheets("sheet2").Cells(1 + i, 2)
PrintOut
Next i
End Sub
我用的是收据打印机,我写的这个代码不能实现一直打印,他打印了打一行数据就出纸了,怎么能实现一直打,打完全部才出纸,我sheet2中有上百行数据,要怎么改print呢??
Sub a()
c = InputBox("开始序号")
b = InputBox("结束序号")
For i = c To b
Sheets("sheet1").Cells(2, 8) = Sheets("sheet1").Cells(2, 8) + 1
Sheets("sheet1").Cells(5, 2) = Sheets("sheet2").Cells(1 + i, 3)
Sheets("sheet1").Cells(6, 4) = Sheets("sheet2").Cells(1 + i, 2)
PrintOut
Next i
End Sub

这个才是
展开
 我来答
风纪UA4
2014-06-03 · 超过59用户采纳过TA的回答
知道答主
回答量:172
采纳率:0%
帮助的人:111万
展开全部
Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Private Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Any, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Private Sub Form_Load()

Dim hPrinter As Long, lNeeded As Long, lReturned As Long
Dim lJobCount As Long
OpenPrinter Printer.DeviceName, hPrinter, ByVal 0&
EnumJobs hPrinter, 0, 99, 1, ByVal 0&, 0, lNeeded, lReturned
If lNeeded > 0 Then
ReDim byteJobsBuffer(lNeeded - 1) As Byte
EnumJobs hPrinter, 0, 99, 1, byteJobsBuffer(0), lNeeded, lNeeded, lReturned
If lReturned > 0 Then
lJobCount = lReturned
Else
lJobCount = 0
End If
Else
lJobCount = 0
End If
ClosePrinter hPrinter
If lJobCount = 0 Then
MsgBox "没有打印作业!"
Else
MsgBox "打印队列项: " + CStr(lJobCount), vbInformation
End If

End Sub
希望对你能有所帮助。
追问
请问怎么改我的代码?我不需要其他的,谢谢
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式