| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 525 人关注过本帖
标题:为什么CASE 1 不能正确打印啊
只看楼主 加入收藏
wfjt
Rank: 1
等 级:新手上路
帖 子:121
专家分:0
注 册:2007-11-30
收藏
 问题点数:0 回复次数:0 
为什么CASE 1 不能正确打印啊
Dim xlApp     As New Excel.Application
 Dim xlBook     As Excel.Workbook
 Dim xlSheet As Excel.Worksheet
  xlApp.Visible = False
    Set xlBook = xlApp.Workbooks.Open("mb.xls")
     On Error Resume Next
Select Case rs1.Fields("gsyh")
Case 0
Set xlSheet = xlBook.Worksheets("sheet1")
     With xlSheet
 .Cells(5, 20) = rs.Fields("cust")
.Cells(9, 12) = rs.Fields("numb")
.Cells(6, 3) = DX(rs.Fields("numb"))
.Cells(4, 3) = rs1.Fields("gsmc")
.Cells(5, 3) = rs1.Fields("gszh")
      End With
      xlSheet.PrintOut

Case 1
Set xlSheet = xlBook.Worksheets("sheet3")
     With xlSheet
 .Cells(5, 20) = rs.Fields("cust")
.Cells(9, 12) = rs.Fields("numb")
.Cells(6, 3) = DX(rs.Fields("numb"))
.Cells(4, 3) = rs1.Fields("gsmc")
.Cells(5, 3) = rs1.Fields("gszh")
      End With
        xlSheet.PrintOut
Case 2
Set xlSheet = xlBook.Worksheets("sheet2")
     With xlSheet
 .Cells(2, 4) = rs.Fields("cust")
.Cells(5, 6) = rs.Fields("numb")
.Cells(4, 6) = DX(rs.Fields("numb"))
.Cells(3, 8) = rs1.Fields("gsmc")
.Cells(3, 4) = rs1.Fields("gszh")
      End With
        xlSheet.PrintOut
 Case Else
 MsgBox ("SORRY没有打印模板")
  End Select
 Application.DisplayAlerts = False
 xlBook.Close (False)
  xlApp.quit
 Set xlBook = Nothing
 Set xlApp = Nothing
其他两个都可以打印 求教啊
搜索更多相关主题的帖子: False 打印 
2013-05-11 17:42
快速回复:为什么CASE 1 不能正确打印啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014282 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved