MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel prog trial time limit. Need advanced help.

Posted by Josh on December 16, 2001 4:57 PM


I am trying to set up a time limit for how long an excel program can be used. Like 30 days and then the program will not run. I can do it generally by something like = if today() > Enddate etc. but anyone could just change the computer system date and open the program anyways. Is there any way to have excel keep trach of how mutch time has ellapsed since the program was first opened. Total time ellapsed even when the program is closed. I need this to not be effected if the user changes the system date.

Can anyone help me out.


Josh Gerrard

Posted by Bruno on December 17, 2001 1:23 AM

Hi Josh,
Yes this is possible

Use a hided, protected worksheet to track your information. For example the date first opened.

- Write a procedure Private Sub Workbook_Open()
- update the information
- save the workbook

Or a better solution : save your information to a XLA file.


Posted by Damon Ostrander on December 17, 2001 9:41 AM


It is hard to protect against the user changing the computer's clock. Of course, seeting the clock back in time can raise havoc with a user's file system since all files created after the (reset) clock date may become unusable. But ignoring this problem, here is what I suggest to protect your program against this. Each time the workbook is opened save the current date/time stamp to a protected (hidden) place, either in the workbook or in a separate file. If that date/time stamp is prior to any previously saved date/time stamp, the user has set the computer clock back and your code can then take action to de-activate the program.

I hope this helps.


Posted by Josh on December 17, 2001 2:21 PM

I think that will help. Thanks (NT)