willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 929
- Office Version
- 365
- Platform
- Windows
I have been looking online for help with this code but haven't quite found what I am looking for and was hoping someone on here could help.
I am looking to lock a workbook with a password after a certain date that will close entirely if the password is incorrect.
Something to this effect:
Any help finishing this code would be greatly appreciated!!
Thank you
I am looking to lock a workbook with a password after a certain date that will close entirely if the password is incorrect.
Something to this effect:
VBA Code:
Private Sub Workbook_Open()
Dim exp_date As Date
exp_date = "9/31/2021"
If Date > exp_date Then
'Make it prompt for a password, if incorrect
MsgBox ("Error")
ActiveWorkbook.Close
'if correct open workbook
End Sub
Any help finishing this code would be greatly appreciated!!
Thank you