time frame

B

brett

i have created various excell based programs for my employees to use, but i
want to have them only accessed for a period of time.
is there show how a way i can add a a specific time frame so if the the
spread sheet is accessed after the time expires (eg. 3 months) the spread
sheet will not open

cheers
brett
 
A

AndyM

Try this code within the ThisWorkbook module:

Const expireDate As Date = #12/1/2008#

Private Sub Workbook_Open()
If Date > expireDate Then
MsgBox "This program has expired."
ThisWorkbook.Close
End If
End Sub

If you are worried about users modifying the expireDate constant, you can
password protect the visual basic project so it cannot be modified. This
code will only close the workbook if macros are enabled. If they are not
enabled, users will not be able to execute any macros, but they can still
have the workbook open.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top