• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to create a Self Destructing Excel Sheel

Notam

New Member
Hello Experts,

I need to create a self destructing Excel sheet which deletes itself after a date is expired or after a predetermined period or file open counts without any warning. Please help

Thnx
 
Hi Notam,

Welcome onboard, as you are new to the forum I suggest you read the link below
http://chandoo.org/forum/threads/new-users-please-read.294/

And your solution might be something like the below code that needs to be implemented in thisworkbook.(workbook_open)module

Code:
Private Sub Workbook_Open()
xdate = "12/12/2013" 'change to desired expiry date
tdate = Format(Now(), "mm/dd/yyyy")
If xdate < tdate Then
Application.DisplayAlerts = False
Sheets("abc").Delete 'change the sheet to desired name
Application.DisplayAlerts = True
Else
End If
End Sub
 
Notam, did you place the code in the workbook_open module?

If yes, save the file once, close it and re-open it and if the expiry is tolerated then it will not delete your sheet else if today's date is more than expiry then it will delete without any prompting...
 
@all
Hi!
When posting code that goes in a particular class module (workbook, worksheets, ...) instead of in any standard module, it's a good and preventing answers like "it doesn't work" to specify where to paste the code, if not uploading a sample file.
Regards!
 
Back
Top