|
楼主 |
发表于 2013-12-16 20:34
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
这个是我在论坛上找到的,谁能帮我收拾一下,能用在自己表上,并且让自己的表只能用几天就不能用了,只有自己修改延长表的使用时间才能用,求大侠们帮忙啊,谢谢了
Sub CheckFileDate()
Dim Counter As Long, LastOpen As String, Msg As String
If RegRead = "" Then
Term = 0 '範例用 0 天
TermDate = DateSerial(Year(Now), Month(Now), Day(Now)) + Term
MsgBox "本檔案只能使用到" & TermDate & "日" & Chr(13) & "超過期限將自動銷毀"
RegWrite (Term)
Else
If CDate(RegRead) <= Now Then
RegDelete
KillMe
End If
End If
End Sub
Sub KillMe()
Application.DisplayAlerts = False
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ThisWorkbook.Close False
End Sub
|
|