Foxtable(狐表)用户栏目专家坐堂 → 打印设置简化代码


  共有1977人关注过本帖树形打印复制链接

主题:打印设置简化代码

美女呀,离线,留言给我吧!
联友
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:300 积分:2565 威望:0 精华:0 注册:2013/5/23 9:49:00
打印设置简化代码  发帖心情 Post By:2016/10/19 13:02:00 [显示全部帖子]

 下面代码能简化吗?

   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编辑过]

 回到顶部