View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
davidm davidm is offline
external usenet poster
 
Posts: 1
Default How to program a code to die


Thanks Mac.

Unfortunately, the idea is not just to delete the code. I need the
procedure to self-destruct after a specified date.

I have since my last post been able to come up with the following
which serves the purpose. (The message boxes are for debugging only and
may not be required in actual application).

Sub CodeToExpireAfterDateA()
Dim x As Date

x = #11/05/2008#
If x Now() Then
MsgBox "Code is alive" 'optional
Call TimedCode
Else
MsgBox "Code has passed used-by date" 'optional
Exit Sub

End If

End Sub


The routine of course returns "Code is alive" in this instance and
calls up "TimedCode". But run after midnight of 11/05/2008, the 2nd
message should be returned and the procedure exited.


David


David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=480988