以下是引用易服在2011-5-24 16:31:00的发言:
一键打印多个报表
Dim Names() As String
Names = New String() {"结果分析表","林种统计表","面积统计表","秋季验收表","补助测算表","坡度统计表","权属统计表","设计汇总表","设计统计表","投资测报表","预算汇总表","植被统计表","验收汇总表","二期补助表"}
For Each Name As String In Names
With Tables("分组统计")
.Select(0 ,0 ,.Rows.Count - 1, .Cols.Count - 1)
End With
Dim Book As New XLS.Book(ProjectPath & "Attachments\" & Name & ".xls") '打开模板
Book.Build() '生成细节区
Book.Save("D:\My Documents\退耕报表\"& Name & ".xls") '保存工作簿
Dim App As New MSExcel.Application
Dim Wb As MSExcel.Workbook = App.WorkBooks.Open("D:\My Documents\退耕报表\"& Name & ".xls")
Dim Wd As MSExcel.Window = Wb.Windows(1) '表示当前工作簿窗口
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Wd.DisplayZeros = False '不显示0值
App.Visible = True
Next
我们知道利用"CheckedComboBox"控件可以选择多值,如果我利用这个控件选择多个报表,那么代码怎么写?我写来写去还是只能打印一个报表,选择两个就没有反应了.