Hi, I am trying to make it so that a spreadsheet cannot be opened without a password after a certain date using VBA.. So far I have this
Private Sub Workbook_Open()
If Sheets(1).Cells(2, 2).Value <= Date And Sheets(1).Cells(2, 2).Value <= Date Then
ActiveWorkbook.Protect Password:="password"
MsgBox "This workbook is locked, please contact nobody@nowhere.com"
Else
'MsgBox "unlocked"
End If
End Sub
This makes it pop up with a message, but only protects workbook structure, so people can still open it.
Any help is appreciated, thanks in advance!
Private Sub Workbook_Open()
If Sheets(1).Cells(2, 2).Value <= Date And Sheets(1).Cells(2, 2).Value <= Date Then
ActiveWorkbook.Protect Password:="password"
MsgBox "This workbook is locked, please contact nobody@nowhere.com"
Else
'MsgBox "unlocked"
End If
End Sub
This makes it pop up with a message, but only protects workbook structure, so people can still open it.
Any help is appreciated, thanks in advance!