Hello sir/maam!
I use this code to expire a workbook and close.
Can i ask to you if it's possible that after workbook expire it clear or delete all the contents in worksheets (all/specific worksheet) then eventually autosave then close.
Any insights or suggestion is much appreciated.
I use this code to expire a workbook and close.
Can i ask to you if it's possible that after workbook expire it clear or delete all the contents in worksheets (all/specific worksheet) then eventually autosave then close.
Any insights or suggestion is much appreciated.
Code:
Private Sub Workbook_Open()
Dim Edate As Date
Edate = Format("20/11/2011", "DD/MM/YYYY") ' Replace this with the date you want
If Date > Edate Then
MsgBox ("This worksheet was valid upto " & Format(Edate, "dd-mmm-yyyy") & " and will be closed")
ActiveWorkbook.Close
End If
If Edate - Date < 30 Then
MsgBox ("This worksheet expires on " & Format(Edate, "dd-mmm-yyyy") & " You have " & Edate - Date & " Days left ")
End If
End Sub