Kid
I dont think that there is a way for a workbook to delete itself.
However, you could have a macro (in the workbook module) that runs whenever the workbook is opened and that automatically deletes all sheets after a specified date.
For instance, the following will automatically insert a blank sheet and then delete all the other sheets if the workbook is opened after May 4, 2000 (i.e. 36650) :-
Private Sub Workbook_Open()
Dim sheet As Object
If Now() > 36650 Then
Application.DisplayAlerts = False
Sheets.Add.Name = "BLANK"
For Each sheet In Sheets
If sheet.Name <> "BLANK" Then
sheet.Delete
End If
Next
MsgBox "All data has just been deleted from this workbook"
End If
End Sub
Before testing the macro, make sure that either you use it on a file that contains unwanted data or you have a back-up copy of the file.
Also, once the specified date has been passed, you will not be able to access the workbook to change the date or gain access to any of the data.
Celia
That would work, but if this is a security issue, there are several ways around this.
#1 Someone can change the system time if they know when the workbook is set to be "destructed".
#2 Macros can simply be disabled - which will not allow the destructive code to run.
Just something to keep in mind if this method is to be used for highly secure data or around computer savvy people.