View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ste mac ste mac is offline
external usenet poster
 
Posts: 117
Default Code For Expiration Date

Juan, here's a starting point... this code is from this ng...
put it in the workbook... it'll fire as soon as the wb is opened...

HTH

seeya ste

Option Explicit

Private Sub Workbook_Open()
'Public should be private when doing this for real
Dim myCutOff As Long
myCutOff = DateSerial(2003, 12, 12)
'just change the date to when you want it to activate

If Date myCutOff Then

MsgBox "I'm sorry, this workbook should have expired on: " _
& Format(myCutOff, "mm/dd/yyyy") & vbLf & _
"After you dismiss this box, this program will pause for: " _
& CLng(Date) - myCutOff & " seconds!" & vbLf & vbLf & _
"One second for each day past expiration!"

Application.Wait TimeSerial(Hour(Now), Minute(Now), _
Second(Now) + CLng(Date) - myCutOff)

End If

End Sub