以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 打印设置简化代码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91801) |
-- 作者:联友 -- 发布时间:2016/10/19 13:02:00 -- 打印设置简化代码 下面代码能简化吗? If _UserGroup = "校长" Or _UserGroup = "教导处" Then End If [此贴子已经被作者于2016/10/19 13:02:50编辑过]
|
-- 作者:baicaocao -- 发布时间:2016/10/19 13:17:00 -- Dim b1 As String = ProjectPath & "Attachments\\在籍学生基本信息.xls" Dim b2 As String = ProjectPath & "Attachments\\基本信息.xls" Dim f1 As String = ProjectPath & "Reports\\在籍学生基本信息.xls" Dim f2 As String = ProjectPath & "Reports\\基本信息.xls" Select Case _UserGroup Case "校长","教导处" Dim Book As New XLS.Book(b1) Book.Build() Book.Save(f1) Case "班主任" Dim Book As New XLS.Book(b2) Book.Build() Book.Save(f2) End Select Dim App As New MSExcel.Application Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl) Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) App.Visible = True Ws.PrintPreview App.Quit |
-- 作者:有点蓝 -- 发布时间:2016/10/19 14:46:00 -- Dim ename As String If _UserGroup = "校长" Or _UserGroup = "教导处" Then ename = "在籍学生基本信息" Else If _UserGroup = "班主任" Then ename = "基本信息" End If If ename > "" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\" & ename & ".xls") Dim fl As String = ProjectPath & "Reports\\" & ename & ".xls" Book.Build() 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(1) App.Visible = True Ws.PrintPreview App.Quit End If
|
-- 作者:良才 -- 发布时间:2016/12/13 9:10:00 -- 谢谢 |