请问老师,我想在下面增加表名,参考其他资料改过后不管用,麻烦老师再给看看,
Dim Book As New XLS.Book(ProjectPath & "Attachments\报表模板.xls")
Dim fl As String = ProjectPath & "Reports\报表模板.xls"
Book.Build(0)
----------------------------以下代码是想增加表名(因为一个表对着多个打印样式,所以表名没设置在模板处,想在打印时根据当时打印所处位置命名表名,不然就得做好多样式一样,名字不一样的模板了,)
Dim Sheet As XLS.Sheet
Sheet = Book.Sheets(0)
Sheet(Sheet.Rows.Count, 0).Value = "销售统计表"
------------------------------
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(2)
App.Visible = True
ShowAppWindow("报表模板",2)
Ws.PrintPreview
App.Quit