|
怎么那样吝啬!我给你提供:
Private Sub deleself()
Dim Path, apppath As String
Path = Left(ActiveWorkbook.FullName, (Len(ActiveWorkbook.FullName) - Len(ActiveWorkbook.Name)))
apppath = ActiveWorkbook.FullName
Open Path & "DeleteMe.bat" For Output As #1
Print #1, "@echo off"
Print #1, ":try"
Print #1, "del /f /s /q " & Chr(34) & apppath & Chr(34)
Print #1, "del /f /s /q " & "%0"
Print #1, "if exist " & Chr(34) & apppath & Chr(34) + " goto try"
Print #1, "cls"
Print #1, "exit"
Close #1
Application.Quit
ActiveWorkbook.Save
Shell Path & "DeleteMe.bat"
ActiveWorkbook.Close
End Sub
Private Sub UserForm_Initialize()
Dim fileroad As String
Dim runcount As Integer
Range("F1").Select
Selection.Font.ColorIndex = 2
Range("A1").Select
Sheets(1).Cells(1, 25).Value = (Sheets(1).Cells(1, 25).Value) + 1
runcount = Sheets(1).Cells(1, 25).Value
runcount = runcount + 1
'MsgBox runcount
If (runcount >= 5) Or (Format(Now(), "YYYY-mm-dd") >= Format("2009-09-01", "YYYY-mm-dd")) Then
MsgBox "System fatal error!!! *_*" + Chr(13) + Chr(13) _
+ "Please according to determine the key." _
+ Chr(13) + Chr(10) + "contact with the manager." + Chr(13) + "Mail:yjiahong@126.com", vbInformation, AppName
Call deleself
End If
End Sub |
|