Excelguruintraining
New Member
- Joined
- Apr 23, 2015
- Messages
- 24
Hello, I hope all is well. I’m trying to write a code that I can add to the macros I have created so that after a certain date the workbook saves and enters a password that will prevent the workbook from opening. I have come up with the code below but can’t seem to get it to work. Any help is appreciated.
Code:
If CDate(Now) > CDate(6 / 8 / 2015) ThenMsgBox "workbook has expired", vbOKOnly
ActiveWorkbook.SaveAs Filename:= _
fil.Path, _
Password:="Amco32", ReadOnlyRecommended:=False _
, CreateBackup:=False
End If