Disabling Excel File 30 Days After Download

dunk123

Board Regular
Joined
Feb 14, 2008
Messages
77
So I wish to post a zipped excel file on the web and have it expire after a certain amount of time (30 days say). This is easy enough by having code running OnOpen in the ThisWorkbook module.

However, what if I want to reliably have this file expire 30 days after the person has downloaded the file? I'm trying to avoid having to replace the file on the web all the time with a new fixed expiry date in the code.

Bear in mind it will be in a compressed folder too. Any thoughts?

Thanks all
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
One possibility would be to create a password-locked worksheet (and password protect the vba code) that can store one value - the first date the file was opened, then you can test based off of that date with something like:

Code:
Private Sub workbook_open()
With Sheets("Cfg").Range("A1")
    If .Value = vbNullString Then
        .Value = Date
    ElseIf .Value + 30 >= Date Then
        MsgBox "Your evaluation period has ended."
        ActiveWorkbook.Close
    End If
End With
End Sub

However, this has several fallacies:
  1. If VBA is disabled, this code will not run
  2. If the person creates a copy of the file before running it the first time, they will be able to work around this code
  3. Excel's security is not very secure. Even password protected workbooks/code can be cracked in seconds.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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