下面代码能简化吗?
If _UserGroup = "校长" Or _UserGroup = "教导处" Then
Dim Book As New XLS.Book(ProjectPath & "Attachments\在籍学生基本信息.xls")
Dim fl As String = ProjectPath & "Reports\在籍学生基本信息.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
Else
If _UserGroup = "班主任" Then
Dim Book As New XLS.Book(ProjectPath & "Attachments\基本信息.xls")
Dim fl As String = ProjectPath & "Reports\基本信息.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
End If
[此贴子已经被作者于2016/10/19 13:02:50编辑过]