|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
以下是引用chengwei0730在2003-8-18 17:53:00的发言:
TO:中国龙
非常感谢您的不吝指教!
还有一个问题想麻烦您一下:
我不想在第一次打开时出现提示信息,
而是在有效期限要到前5天开始每天出现提示信息,
您好:
程式碼加一句判斷式就行了
Sub CheckFileDate()
Dim Counter As Long, LastOpen As String, Msg As String
Chk = GetSetting("Chinese dragon", "Budget", "Date", "")
If Chk = "" Then
Term = 10
TermDate = DateSerial(Year(Now), Month(Now), Day(Now)) + Term
SaveSetting "Chinese dragon", "Budget", "Date", TermDate
Else
If CDate(Chk) <= Now Then
DeleteSetting "Chinese dragon", "Budget", "Date"
KillMe
End If
If CDate(Chk) - Now < 5 And CDate(Chk) - Now > 0 Then
MsgBox "本檔案只能使用到" & Chk & "日" & Chr(13) & "超過期限將自動銷毀"
End If
End If
End Sub |
|