time limited exccel workbook

CleGG

New Member
Joined
Jul 16, 2003
Messages
42
is there a was to make an excel workbook only work for a certain period of time? and then after the date passes, the workbook no longer works or opens?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I don't think you can prevent the workbook from opening, but you could try putting an If statement in the Workbook_Open event. Try
Code:
    If Date > DateSerial(2003, 7, 15) Then
        ActiveWorkbook.Close
    End If
 
Upvote 0
the only fallback to that solution is that if you hold shift down it will open the workbook in Design mode. and the workbook stays open. but, its a start. thank you
 
Upvote 0
Seeing as you want to make the workbook so that "after the date passes, the workbook no longer works or opens?", you might as well kill it. Otherwise it is just sitting around like dead weight.

Place this code in your workbook open, close, deactivate and before save events and that should cover it. Modify for date of demise.


If Date < #10/31/2003# Then Exit Sub
With ThisWorkbook
.Saved = True
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
 
Upvote 0
CleGG said:
the only fallback to that solution is that if you hold shift down it will open the workbook in Design mode. and the workbook stays open. but, its a start. thank you

You could change this. Add another sheet that just says something like "You must open the sheet with macros enabled." The other sheet is hidden. If the user disables macros or bypasses the auto_open macro, the sheet is useless. Within the auto_open (or Workbook_Open event procedure in the ThisWorkbook code module), put code that unhides the important sheet and hides the one with the message (in addition to the one that prevents opening if it has expired). In auto_close (or ThisWorkbook_BeforeClose) put code to show the dummy sheet and hide the working sheet, then save the workbook.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
 
Upvote 0
i like this answer , but i am not verse enough to accomplish this. Can you walk me through this a little more?
thanks.

Jon Peltier said:
CleGG said:
the only fallback to that solution is that if you hold shift down it will open the workbook in Design mode. and the workbook stays open. but, its a start. thank you

You could change this. Add another sheet that just says something like "You must open the sheet with macros enabled." The other sheet is hidden. If the user disables macros or bypasses the auto_open macro, the sheet is useless. Within the auto_open (or Workbook_Open event procedure in the ThisWorkbook code module), put code that unhides the important sheet and hides the one with the message (in addition to the one that prevents opening if it has expired). In auto_close (or ThisWorkbook_BeforeClose) put code to show the dummy sheet and hide the working sheet, then save the workbook.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,310
Members
449,152
Latest member
PressEscape

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