Sheets expiration date

Have you thought sometimes pass their sheet to a friend, colleague or a third party and not knowing how they will use them, or worse appropriating their ideas? I put this down to a code where your spreadsheet will expire when the user closes it.

Private Sub Workbook_BeforeClose (Cancel As Boolean)
As Date Dim dtexp
'Select the date which will expire
dtexp = ("29/04/2011") 'here inhibit'
If Date> = # 1/11/2010 # Then 'turn this'
If Date> = dtexp Then 'inhibiting here'
ThisWorkbook.Saved = True
'If you want to send message only remove the single quote of the bottom line or customize
'MsgBox "This file is expired, if auto-delete!"
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
end If
end If
end Sub

** Note will not even to trash

Nenhum comentário: