|
SaveCopyAs 方法
参阅参阅参阅参阅将指定工作簿的副本保存到文件,但不更改内存中的打开工作簿。- Sheet1.Activate
- If Year(Date) > Sheet4.[b2] Then
- MsgBox "新年度在d盘许可档案备份目录下自动备份上年度档案表,清空后重新开始工作!", , "提示"
- aa = InputBox("请输入继续工作密码!", "密码录入")
- ' DoEvents
- If aa = VBA.Format(VBA.Date, "YYYYMMDD") Then
- MsgBox "密码正确!欢迎在新年度使用系统!"
- Dim TheBackUpDir As String
- TheBackUpDir = "D:\许可档案备份"
- If Len(Dir(TheBackUpDir, vbDirectory)) = 0 Then
- MkDir TheBackUpDir
- End If
- ThisWorkbook.SaveAs TheBackUpDir & "" & Year(Date) - 1 & "工业产品档案备份.xls"
- With ActiveWorkbook
- For Each ms In .Sheets(1).Shapes
- If ms.Type = 6 Or ms.Type = 8 Then ms.Delete
- Next ms
- For Each vbc In .VBProject.VBComponents
- If vbc.Type = 100 Then
- vbc.CodeModule.DeleteLines 1, vbc.CodeModule.CountOfLines
- End If
- Next vbc
- End With
- Application.EnableEvents = False
- Sheet1.Range("A3:T" & Sheet1.Range("A65536").End(3).Row).ClearContents
- Sheet4.[b2] = Year(Date)
- Sheet1.Select
- Application.EnableEvents = True
- Else
- MsgBox "密码错误,程序退出!"
- Application.Quit
- ' ActiveWorkbook.Close False
- End If
- End If
复制代码 |
|