Variable day expiry date

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
Code:
Sub Auto_Open()
    Dim exdate As Date
    exdate = "27/06/2007"
    If Date > exdate Then
         MsgBox ("This file has expired")
        ActiveWorkbook.Close
    End If
    MsgBox ("You have " & exdate - Date & "Days left")
End Sub
The code expires the file on the basis of a date specified in the macro

Can this code be modifoed in a manner which will expire the file after certain days on opening of a file say after seven days?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I'm not sure whether do you have other security measures to secure the file as if you didn't know.. by disabling macro's, one can get to access the file anyway..and to delete the macro thus giving them restriction free usage
 
Upvote 0

Forum statistics

Threads
1,215,999
Messages
6,128,193
Members
449,431
Latest member
Taekwon

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