static ptime As Date
If ptime <> Date.Today AndAlso Format(Date.Now, "HH:mm") >= "15:25" AndAlso Format(Date.Now, "HH:mm") <= "15:30" Then
MyTimers("计划1").Enabled = False
Dim Book As New XLS.Book(ProjectPath & "Attachments\订单.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\订单.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(3,9).Value = "<日期 = # " & Date.Today & "#>" '写入打印条件
Book.Build() '生成报表
Book.Save(fl)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.PrintOut(Preview:=False,ActivePrinter:="RICOH Aficio MP 7001") '直接打印;http://www.foxtable.com/webhelp/topics/2121.htm
'Ws.PrintOut(Preview:=True,ActivePrinter:="RICOH Aficio MP 7001")
App.Quit
ptime = Date.Today
MyTimers("计划1").Enabled = True
End If
帮忙看看这个代码放到计划管理没有问题吧 刚刚狐表崩溃了 打印任务成功下发
间隔:3000
[此贴子已经被作者于2019/10/10 15:38:32编辑过]