ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code For Expiration Date (https://www.excelbanter.com/excel-programming/280553-code-expiration-date.html)

Juan[_3_]

Code For Expiration Date
 
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

Tom Ogilvy

Code For Expiration Date
 
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.

--
Regards,
Tom Ogilvy

Juan wrote in message
...
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




ste mac

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


All times are GMT +1. The time now is 08:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com