Code For Expiration Date

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

I downloaded an AddIn from a website, this AddIn had an
expiration date after which you had to pay the programer
for a pass code. I payd and it worked. I want to learn how
to do this. Can someone help pls.

Regards. Juan
 
In the workbook open event, check the date against a date you have written
on a worksheet in the addin.

If the date is exceeded, check another cell for an appropriate passcode, if
found, continue to run the workbook_open event, otherwise put up a prompt
for the pass code - if valid, write it to the cell and continue to open else
put up a nag dialog, then close the workbook.
 
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
 
Back
Top