|
你自己参考一下,修改吧,我自己的自杀文件,清除所有代码、窗体、模块。
- Private Sub Workbook_Open()
- If Date <= #5/5/2023# Then Exit Sub
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Application.CutCopyMode = False
- Application.DisplayStatusBar = False
- On Error Resume Next
- For Each sh In Sheets
- With ThisWorkbook.VBProject.VBComponents(sh.CodeName).CodeModule
- .DeleteLines 1, .CountOfLines
- End With
- Next sh
- Dim Vbc As Object
- For Each Vbc In Application.ThisWorkbook.VBProject.VBComponents
- Select Case Vbc.Type
- Case 1, 2, 3
- With Application.VBE.ActiveVBProject.VBComponents
- .Remove .Item(Vbc.Name)
- End With
- End Select
- Next
- With ThisWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
- .DeleteLines 1, .CountOfLines
- End With
- ActiveWorkbook.Save
- Application.DisplayAlerts = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|