Excel文件自杀代码
Excel文件自杀代码Private Sub Workbook_Open()
chk = GetSetting("hhh", "budget", "date", "")
If chk = "" Then
termdate = "2011-05-01"
MsgBox "本工作簿只能使用到" & termdate & vbCrLf & "超过期限将自动销毁!", vbExclamation
SaveSetting "hhh", "budget", "date", termdate
Else
If CDate(chk) <= Now Then
DeleteSetting "hhh", "budget", "date"
killme
Else
MsgBox "本工作簿只能使用到" & CDate(chk) & vbCrLf & "超过期限将自动销毁!", vbExclamation
End If
End If
End Sub
Public Sub killme()
Application.DisplayAlerts = False
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ThisWorkbook.Close False
End Sub
页:
[1]