Office中国论坛/Access中国论坛
标题:
提供最新excel在运行4次或在指定日期后运行,excel自杀源码
[打印本页]
作者:
yjiahong
时间:
2009-4-26 22:43
标题:
提供最新excel在运行4次或在指定日期后运行,excel自杀源码
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
作者:
OKK
时间:
2009-4-27 09:30
好象有比上面代码还简练的!
作者:
yjiahong
时间:
2009-5-2 10:34
因为设计的存储方式不一样
作者:
www96
时间:
2009-6-15 18:46
作者:
刘志文
时间:
2009-9-20 22:19
学习一下
作者:
boss654321
时间:
2009-12-28 17:35
用的是批处理吧。我以前一直想这么做,就是打开表时不能删,这下可以好好研究一下了。谢谢分享
作者:
ljx63426
时间:
2010-3-15 18:12
谢谢分享
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3