2 questions - Creating a TimeBomb - Securing Code

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have two questions, I have created a mini VBA
application as a qualifying tool. I would like for that
application to stop working after a given date, so users
are forced to come back to me for the most current version
of the application. I had considered placing an if then
statement in the userform initialize area, so if the
system date is greater than the preset time, they would
receive an error message directing them back to me for an
updated copy. Could someone give me an idea of the code
that would accomplish this task, or alternately if there
are other ideas on how to achieve the end result, that
would also be greatly appreciated.

Part 2, is anyone aware of a good source of information on
how to practically protect users from accessing the VBA
code area of the document. I also know that this
protection is moderate at best, but a low hurdle for the
casual user should be good enough for this application.

Thanks for any assistance

Dave
 
Try this...
------------------------
Private Sub Workbook_Open()

Dim Expire As Date

Expire = #10/31/2003#

If Now < Expire Then
MsgBox "Your spreadsheet application will expire on: "
& Expire
Else
MsgBox "Your spreadsheet application has expired!",
vbCritical
ThisWorkbook.Close
End If

End Sub
 
David,

For question #2

You can go into the VBE and protect the project. Fair
or you can build your code into an Add-In and distribute this with the
workbook. Better.
I think a 'dll' is best, but don't know much about that.
 
"BANG" .....
That is the sound of my "bubble" bursting,..

So...holding down the shift key while opening bypasses
code associated with the workbook open "time bomb". Is
there an easy way around that. I suppose that most casual
users will not know to do that shift trick when it
expires, but if there was a more robust method which I
could implement, it would probably be better.

Thoughts?
Thanks for the heads up
 
The user always has the option of disabling macros. Most will be prompted
to do it in the current environment of viruses and their security settings
will be set to warn of macros. In xl2000 and later, if security is set to
high and they have not accepted the code as being from a trusted source
(given that it was certified), the macro will be disabled without prompt.

If you put the code in an Addin, then the code will not be disabled I don't
believe. So you might have to distribute an addin and a workbook - this may
not be all bad - as you just update the Addin and the users data stays in
tact. (which may or may not be applicable to your application).

There are games you can play with hiding sheets and so forth so nothing
useful is visible if macros are not enabled, but none of these approach is
foolproof. There are even password crackers readily available that will
allow a user to get into your code if you have it protected.
 
Back
Top