Dim cbx As WinForm.ComboBox = e.Form.Controls("合格证模板") Tables("打印").Filter = "[合格证模板] = '" & cbx.text & "' And [打印] = False " If Tables("打印").Rows.Count = 0 Then '如果是一个空表 MessageBox.Show("没有要打印的数据!", "提示") Return '那么返回 Else '选定筛选的表 With Tables("打印") .Select(0,0, .Rows.Count -1, .Cols.Count -1) End With End If Dim Book As New XLS.Book(ProjectPath & "images/Attachments\合格证模板.xls") Book.Build() Book.Save(ProjectPath & "Reports\" & cbx.text & ".xls") Dim Proc As New Process Proc.File = ProjectPath & "Reports\" & cbx.text & ".xls" Proc.Start() For Each r As Row In Tables("打印").Rows r("打印") = True Next
|