Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Expiration Date for Excel Programs.

Expiration Date for Excel Programs

by Allen Wyatt
(last updated November 22, 2014)

3

Excel provides a robust development environment of which many people take full advantage. In fact, many people have written entire application programs using VBA with Excel as the framework.

If you do program development in Excel, you may be wondering if there is a way to write your program so that it will no longer work after a specific date. Fortunately, this is rather easy. One solution is to use something like the following as an Auto_Open macro:

Sub Auto_Open()
    Dim exdate As Date
    exdate = "12/31/2014"
    If Date > exdate Then
        MsgBox ("You have reached end of your trial period")
        ActiveWorkbook.Close
    End If
    MsgBox ("You have " & exdate - Date & "Days left")
End Sub

If the date on the system running the program is greater than the date specified in the exdate variable, the user will see a message box indicating that their trial period has expired. When the user clicks on the OK button, the workbook closes. If the trial period is not over, then the message box indicates how many days are left in the period.

Of course, if you put a macro such as this in your application, it may stop you from opening the workbook to make program changes. The obvious way around this, of course, is to hold down the Shift key as you open the workbook. Doing so stops the Auto_Open macro from running. If your users know this, they can bypass the expiration check just as easily as you, however. The solution is to place similar checks within other macros that cannot be bypassed and that are essential to your program.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10230) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Expiration Date for Excel Programs.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Adding Endnotes in Text Boxes

Text boxes and endnotes are both great tools you can use within a document. Problem is, you cannot use them ...

Discover More

Changing Links

If your worksheet is linked to data in other worksheets, you may need to change the link from time to time. Here's how to ...

Discover More

Converting UNIX Date/Time Stamps

If you import information generated on a UNIX system, you may need to figure out how to change the date/time stamps to ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Page Numbers in VBA

When you print a larger worksheet, Excel breaks the printout across several pages. You may want to know, before you print, ...

Discover More

Adjusting a Path Based on System and User

It is not uncommon to set variables in a macro based on other values, such as time or date. You could also set variables ...

Discover More

Removing All Macros

Macros are stored as part of a workbook so that they are always available when you have the workbook open. If you want to get ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 0?

2016-01-19 06:02:24

Barry

The simplest way is to hold down the "Shift" key when opening the file. This disables macros thereby bypassing the expiry check.

To get around a system time change, it is possible to get the time from the Internet (a working Internet connection is, of course, required for this to work). There are lots of code examples of this on the Internet.

All the worksheets should be set to "VeryHidden" whenever the workbook is saved or closed, except for one worksheet which advises the User to enable macros in order to access the Workbook, and unhidden when the workbook is opened provided the license date hasn't expired.


2016-01-18 22:13:40

Eric

one way to bypass the expiration date is to change the system date to older date and run the excel file again. hope it helps .


2015-04-21 02:01:57

Kusyadi

thanks a lot.....


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.