plaodj 发表于 2019-5-6 23:04:14

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]
查看完整版本: Excel文件自杀代码