![]() |
Time limit
Hi...
Is it possible to code a macro so that a file won't open after a certain date? Cheers Gordon... |
Time limit
Hi, put this code in the ThisWorkbook module:
Private Sub Workbook_Open() If DateValue(Now()) DateValue("29/09/2008") Then ThisWorkbook.Close False End Sub Change the "29/09/2008" to whatever date you want. The False after the ThisWorkbook.Close is to save the changes. Hope this helps. On 29 Sep, 14:35, Gordon wrote: Hi... Is it possible to code a macro so that a file won't open after a certain date? Cheers Gordon... |
Time limit
You can also control it within the macro with an If ... Then statement:
Sub myMacro() If Date = DateValue("October 1, 2008") Then Exit Sub End If 'myMacro Code End Sub "Gordon" wrote: Hi... Is it possible to code a macro so that a file won't open after a certain date? Cheers Gordon... |
Time limit
Gordon,
It's extremely unlikely that any VB method would deter even a slightly experienced user or a novice with access to Google. Both of replies you have require macros enabled and if they aren't enable then the code doesn't execute and the workbook opens. Have a look at Chip Pearson's site who explores the problem in some depth and points aout the shortcomings of any VB approach. http://www.cpearson.com/excel/WorkbookTimeBomb.aspx Mike "Gordon" wrote: Hi... Is it possible to code a macro so that a file won't open after a certain date? Cheers Gordon... |
All times are GMT +1. The time now is 09:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com