要做基于excel模板的打印,但不希望用帮助里的代码,会打开excel的,希望能直接打印
我在论坛搜到一段代码:
Dim Book As New XLS.Book(ProjectPath & "Attachments\订单.xls")
Dim file As String = ProjectPath & "Reports\订单.xls"
Book.Build() '生成细节区
Book.Save(file) '保存工作簿
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(file)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
With Ws.PageSetup
.PaperSize = MSExcel.XlPaperSize.xlPaperA4 '纸张大小
.CenterHorizontally = True '页面水平居中
.CenterVertically = True '页面垂直居中
.Zoom = False '以下设置将缩印在一页内
.FitToPagesWide = 1 '按照1页的宽度打印
.FitToPagesTall = 1 '按照1页的高度打印
End With
App.Visible = True
Ws.PrintPreview
App.Visible=False
wb.save
wb.close
App.Quit
我是要在四联纸上打印(宽:24cm 高14cm)
要如何改红色部分的代码啊?