Thread: Kill file
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ward376 ward376 is offline
external usenet poster
 
Posts: 360
Default Kill file

In the ThisWorkbook module try...

Option Explicit
Dim Expiry As Long

Private Sub Workbook_Open()
Expiry = 38958 'serial number for date 8/29/6
If Date = Expiry Then
MsgBox "This workbook has expired." 'warning optional
With ThisWorkbook
.Save
.ChangeFileAccess Mode:=xlReadOnly
Kill .FullName
.Close SaveChanges:=False
End With
End If
End Sub