这是不用打开EXCEL表而直接打印的,打印完就关闭了 CurrentTable.SaveExcel("C:\test.xls","sheet1",False) Dim Book As New XLS.Book("C:\test.xls") '打开模板 Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim r As Integer = Sheet.Rows.Count-1 Dim c As Integer = Sheet.Cols.Count -1 With Sheet.PrintSetting '页眉 .Header = "&L"&"期间:" & e.Form.Controls("DTPqsrq").Value & "至" & e.Form.Controls("DTPjzrq").Value End With Sheet(r+2,c).Value = "制单人:" & User.Name Book.Save("C:\test.xls") '保存工作簿 Dim Proc As New Process Proc.File = "C:\test.xls" Proc.Verb = "Print" '指定动作 Proc.Start()
|