Liam from EverythingZing in Letchworth writes;
Hi Carl, I am looking for a macro that makes the excel file either self-delete or expire after a set period of time. Any suggestions would be appreciated.
First of all, it is not possible to make an Excel file self delete, Microsoft put in all sorts of safe guards to stop macros being used in bad ways, however there are ways we can make the functionality expire.
Have a look at this macro
-
Sub MyMacro()
ExpireDate = #1/1/2011#
If Now() < ExpireDate Then
‘Your macro goes here
End if
End Sub
-
What this macro does is it checks today’s data against a predefined date, in this case 1st Jan 2011. If the day the macro is run is before the predefined date, then your macro will run as normal, if not it won’t.
There are some variations you might want to try. Try adapting the macro so it runs when the spreadsheet opens, that way you can use the macro to instantly close the file back down again if it is opened after the expiration date.
-
-
-