Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Expiration Date for Spreadsheet

Expiration Date for Spreadsheet

Expiration Date for Spreadsheet


I have some spreadsheets I have created and want to protect.  I have several people who want to use them under a licensing agreement.  I would like to add an expiration date to the spreadsheets so that after a certain date, the spreadsheet no longer functions.  Is there an easy way to accomplish (I know "easy" is relative, I am a novice+ Excel user)?


Greg Lamberson, BS, MBA
Consultant - Upstream Energy
Website: www.oil-gas-consulting.com

RE: Expiration Date for Spreadsheet

Sub Auto_Open()
 ActiveWorkbook.PrecisionAsDisplayed = False
  If Date < #6/15/2008# Then Exit Sub
    With ThisWorkbook
.Saved = True
.ChangeFileAccess xlReadOnly
 Kill .FullName
.Close False
    End With
End Sub
Sub ByeMessage()
'Self-Destruct Final Message no response needed, just OK
 ln1 = "This spreadsheet has a defined expiration date which has expired.  Upon"
 ln2 = "acknowledgement this file will be deleted.  Contact the author for another copy."
 ln3 = ""
 ln4 = "        email - home:  XXXXXXX@XXXX.com  /  work:  XXXXXXXXXXXXX@XXXX.com"
 ln5 = "                                       Tel: XXX.XXX.XXXX"
 msg = ln1 & vbCr & ln2 & vbCr & ln3 & vbCr & ln4 & vbCr & ln5
style = vbOKOnly + vbInformation
Title = "                          <<<  XXXXXXX© January 200X,  by Me  >>>"
MsgBox msg, style, Title
End Sub

RE: Expiration Date for Spreadsheet

Which can be disabled by simply setting macro security to High.

RE: Expiration Date for Spreadsheet

True Mint Julep, but if you also place some of the most important calculations in VBA, you're most assured it'll be used with macros enalbed.

RE: Expiration Date for Spreadsheet

Besides which, the macro will have the desired effect for 99% of all users. That last 1% could probably figure out how to defeat the macro anyway. At some point, you reach the point of diminishing returns.

RE: Expiration Date for Spreadsheet

You can also Password protect the VBA Code, to even more slim down the number of Users able to defeat the Security. It makes it impossible for them to even read the code.


RE: Expiration Date for Spreadsheet

I would put conditional formating that will make the cells all black if the NOW() function is pass certain date.  And maybe put a red statement saying it expires.  Make sure you put a password so people cant edit it.

Never, but never question engineer's judgement

RE: Expiration Date for Spreadsheet

Presumably there's a way to re-save the sheet in disabled or otherwise unusable form so that it can't be re-opened with functionality restored by getting the PC to lie to the sheet about what the date really is . . . simultaneously with or immediately prior to the display of the expiration message might be an appropriate time to do that.


RE: Expiration Date for Spreadsheet

I have implemented expiry dates in some of my spreadsheets.  My approach to NormPeterson's worry (that users - bless their little hearts - might crank their system clocks back) has been to have the spreadsheet keep track of the latest date on which it has been run.

This is stored, in encrypted form to make things a little harder for misbehavers, in the Registry.  It allows me to detect reverse time travel, and treat it appropriately.  (The VBA operations for this use GetSetting and SaveSetting.)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close