PDA

View Full Version : Solved: Set a Trial Period For Use of Your Project



Derek
11-21-2005, 10:30 AM
I refer directly to the KB on the above subject. This works beautifully! we have 30+ people using an excel application remotely which I designed and update. It is protected as best we can however I would like the ability to "kill" the application if someone leaves us, or have the ability to change the "trial" period. Every day or two we send out an add-on worksheet to the application. It includes variables needed for the main workbook. I thought I could use this to store a "kill" cell which has a lower trial period duration. For example, if the original link was for say 35 days, it would allow for monthly updates to supercede the expiry date. However, if someone was to leave (or we suspected someone was going to leave us), I would ike to be able to change that time to say 30 minutes.

Any thoughts?:hi:

johnske
11-22-2005, 06:53 PM
Hi Derek,

In all conscience I'm not sure I can answer this. I'm not saying it can't be done, but what you're asking for is basically a Virus that's going to be enclosed in an email to kill a workbook on someone elses computer. (And a workbook that was given to them with the understanding that they had full use of it for a given period of time to boot).

This could so easily be changed to a procedure to kill any (all) workbooks on the others computer.

Regards,
John

johnske
11-22-2005, 07:55 PM
Probably the best I can offer is code to reset the trial period. This would have to be sent as a zipped file and you would have to depend on the person at the other end opening the workbook...

On opening, the trial period is reset (but if they wake up to what's happening they could constantly extend this by opening the zipped file whenever they wanted to use the other book) Private Sub Workbook_Open()
Dim StartTime#, CurrentTime#

'*****************************************
'SET YOUR OWN TRIAL PERIOD BELOW
'Integers (1, 2, 3,...etc) = number of days use
'1/24 = 1Hr, 1/48 = 30Mins, 1/144 = 10Mins use

Const TrialPeriod# = 1 / 48 '< 30 minutes trial

'set your own obscure path and file-name
'(to re-set the period you would already
'know the path and file you used)
Const ObscurePath$ = "C:\"
Const ObscureFile$ = "TestFileLog.Log"
'*****************************************
StartTime = Format(Now, "#0.#########0")
Open ObscurePath & ObscureFile For Output As #1
Print #1, StartTime
Close #1
End Sub

johnske
11-22-2005, 09:02 PM
Correction: Sorry, what I gave you above would actually extend the trial period (the start time). What you need to do is work out how much time they have left and then subtract what you need to...

E.G. If they have 30 days plus 30 minute use left you would use StartTime = Format(Now - 30, "#0.#########0")or, in fullOption Explicit
Sub ResetTrialPeriod()
Dim StartTime#
'*****************************************
'set your own obscure path and file-name
'(to re-set the period you would already
'know the path and file you used)
Const ObscurePath$ = "C:\"
Const ObscureFile$ = "TestFileLog.Log"
'*****************************************
StartTime = Format(Now - 30, "#0.#########0")
Open ObscurePath & ObscureFile For Output As #1
Print #1, StartTime
Close #1
End Sub

Derek
11-24-2005, 08:11 AM
Johnske
Thanks very much for this. I have tested this out and it works exactly as I wanted. Please be assured that our intentions are definitely genuine.

Thank you so much for your efforts and input

Derek:bow:

mark007
11-27-2005, 07:10 PM
Thought twice about posting this but I don't believe it to be particularly malicious given that it's easy to craete a macro to delete some files anyway - there is always an element of trust when you open a workbook with macros. You want to use a modified version of somethign like this:

http://www.thecodenet.com/articles.php?id=28

This is based on an exe but the principle is the same.

:)