Excel Timer??

Utradeshow

Well-known Member
Joined
Apr 26, 2004
Messages
809
Office Version
  1. 365
If you e-mail someone a excel workbook, can you put a timer on the workbook so it will only work for say 30 days????
 
I have, in the past, used something like this (assuming that you're not sending it to a good hacker):

1. Press Alt-F11 to bring up VBA
2. In the pane to the left, double click on "This Workbook".
3. Add the following code:

Code:
Private Sub Workbook_Open()
If Now() > #3/1/2004# Then
Serial = InputBox("Trial is over. Input required serial number. Pay up cheapskate!!!!")
If Serial <> "ABCDEF" Then
ActiveWorkbook.Close
End If
End If
End Sub

You should then password the VBA so no-one can get in.

Let me know how it goes.
:-D
 
Upvote 0
Does the date 3/1/2004 mean anything?? Does it just last 30 days before it asks for password??

I like the Pay up Cheapskate!!! That's hilarious!!!
 
Upvote 0
That is the date that it will look for.

For 30 days from today, use #5/28/2004#.

By the way "Pay up cheapskate" is the clean version. I was not that subtle in the version I did!!!!
 
Upvote 0
I'm new at this stuff.. Please forgive me.. I hit Alt F-11 but I didn't see what you mentioned??? :roll:
 
Upvote 0
Alt + F11 should open up VBE on the left you should have a panel that lists the sheets and thisworkbook. If not then goto View and select Project Explorer.
 
Upvote 0
Hi All

A different approach:

Create a useless Sheet and name it Sorry, then create a Sheet and name it Data. If macro is disabled this the only visible sheet will be sorry. After the trialperiod your workbook will be saved and closed with a changed password and the important sheet data will be deleted. If they manage to crack the password, the only sheet left will be Sorry!

Code:
Private Sub Workbook_Open()
Application.ScreenUpdating = False
    'Show sheets available when macro is enabled
    Sheets("Data").Visible = True
    Sheets("Data").Select
    Range("A1").Select
        'If 30 days has passed change password to "locked" or whatever, if else nothing
        If Now() > #5/28/2004#  Then
        Application.DisplayAlerts = False
            'Show and select available Sheet when macro is disabled
            Sheets("Sorry").Visible = True
            Sheets("Sorry").Select
            Range("A1").Select
            'Delete important WorkSheets! The only option left will be to
            'open with macro's disabled and with sheets("Sorry")
            Sheets("Data").Delete
            'Change or set PassWord
            ActiveWorkbook.SaveAs Password:="locked"
            'close WorkBook and Save Changes
            Application.Quit
            ThisWorkbook.Close SaveChanges:=True
        Application.DisplayAlerts = True
        Application.ScreenUpdating = True
        End If
    'Hide sheets available when macro is disabled
    Sheets("Sorry").Visible = xlVeryHidden
Application.ScreenUpdating = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
    'Show sheets available when macro is disabled
    Sheets("Sorry").Visible = True
    Sheets("Sorry").Select
    Range("A1").Select
    'Hide sheets available when macro is enabled
    Sheets("Data").Visible = xlVeryHidden
Application.ScreenUpdating = True
End Sub

/Roger
 
Upvote 0
That worked Great Jacob.. Thank you... Maybe I'll give Rogers a try too..

Thanks Guys... Dan
 
Upvote 0
Roger's is probably better, as mine can be worked around by disabling macros.

Having said that:
1. My worksheets are fairly useless to the users without the other macros, and
2. I don't think any of them know enough Excel to even think of disabling the macros.

Thanks Roger, I will take this on board and try it next time I need a better method.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top