|
发表于 2014-11-1 20:17
|
显示全部楼层
本楼为最佳答案
- Private Sub CommandButton1_Click()
- Dim i, k
- i = Sheets("打印").[a4].End(xlDown).Row
- k = Sheets("打印").[l65536].End(xlUp).Row + 1
- Sheets("打印").Range("l" & k) = Now() & "打印居民医疗保险费用支付清单"
- k = Sheets("打印").[l65536].End(xlUp).Row + 1
- Sheets("打印").Range("a4:g" & i).Copy Sheets("打印").Range("i" & k)
- PrintPreview
- PrintOut From:=1, To:=1, Copies:=1, Collate:=True
- Dim strFilename$
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- strFilename = ThisWorkbook.Path & ""
- strFilename = strFilename & Format(Date, "yyyy-mm-dd") & Mid(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, "."))
- ActiveSheet.Copy
- For Each obj In ActiveSheet.Shapes
- obj.Delete
- Next
- With ActiveWorkbook.VBProject.VBComponents("sheet2")
- .CodeModule.DeleteLines 1, .CodeModule.CountOfLines
- End With
- ActiveWorkbook.SaveAs Filename:=strFilename
- ActiveWorkbook.Close True
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码 |
评分
-
查看全部评分
|