Not Open Excel File After Fixed Date!
I got a VB code, from our forum. However, want to make modify as per following.
Currently, If I put to save excel file all other sheets (except sheet 1) are hidden. (before expire)
I do not want to be hidden until Excel File expires, by his expire in date like here 2009,01,10
Code:
Private Sub Workbook_Open()
Dim i As Integer
If Date <= DateSerial(2009, 1, 5) Then
Application.ScreenUpdating = False
ThisWorkbook.Unprotect Password:="___"
For i = 2 To Worksheets.Count
Worksheets(i).Visible = True
Next i
ThisWorkbook.Protect Password:="___"
Application.ScreenUpdating = True
Else
MsgBox "This file cannot be accessed after Jan. 05, 2009."
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim i As Integer
Application.ScreenUpdating = True
ThisWorkbook.Unprotect Password:="___"
For i = 2 To Worksheets.Count
Worksheets(i).Visible = xlVeryHidden
Next i
ThisWorkbook.Protect Password:="___"
Application.ScreenUpdating = True
End Sub
Bookmarks