码迷,mamicode.com
首页 > 其他好文 > 详细

打印预览

时间:2019-10-02 12:43:30      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:ext   mod   type   ksh   eval   数据   cells   val   预览   

 1 Sub Browse_Click()
 2     打印信息
 3     Dim columnCount As Integer 列数
 4     Dim rowCount As Integer  行数
 5     columnCount = getColumnCount(XsXxSheet)
 6     rowCount = Application.CountA(ActiveSheet.Range("B:B"))
 7     If rowCount = 0 Then
 8         MsgBox ("没有数据,无需打印!")
 9         Exit Sub
10     End If
11     If rowCount = 1 Then
12         MsgBox ("没有数据,无需打印!")
13         Exit Sub
14     End If
15     
16     Worksheets("学生信息打印模板").Visible = True
17     弹出打印提示窗口
18     循环1--行
19      For ro = 2 To 2
20         循环2--列  填写学生模板信息-->生成新的Excel
21        For col = 1 To columnCount
22            Title = Sheets(XsXxSheet).Cells(1, col)
23            If Title <> "" Then
24              Dim content As String
25              content = Sheets(XsXxSheet).Cells(ro, col)
26              Dim exl As TypeValueCell
27              exl.cellName = Title
28              exl.cellContent = content
29              aa = fileXsExportModel(exl)
30            End If
31         Next col
32     Next ro
33     Worksheets("学生信息打印模板").PrintPreview
34     清空模板
35      For col = 1 To columnCount
36          Title = Sheets(XsXxSheet).Cells(1, col)
37          If Title <> "" Then
38            Dim content2 As String
39            content2 = Sheets(XsXxSheet).Cells(2, col)
40            Dim exl2 As TypeValueCell
41            exl2.cellName = Title
42            exl2.cellContent = content1
43            bb = clearXsExportModel(exl2)
44          End If
45       Next col
46     Worksheets("学生信息打印模板").Visible = False
47 End Sub

 

打印预览

标签:ext   mod   type   ksh   eval   数据   cells   val   预览   

原文地址:https://www.cnblogs.com/xiehaofeng/p/11616951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!