Mark Drelinger
asked on
add a password to open excel after 60 days
I have an excel document that I want to require a password to open after 30 days.
I don't want to kill or delete the document, just require a password.
I don't want to kill or delete the document, just require a password.
So no password until 30 days after creation?
You would have to have the date the workbook was made written in the sheet somewhere. A macro that runs when the file is opened could then check if the current date is 30 days after the creation date, set a password and force the file closed. However that solution has some downsides, such as requiring that somebody try to open the file before the passwords get set.
The most secure way would be if you could password protect the files without opening them. But I don't think that would be an Excel solution, it would have to happen at the windows level.
You would have to have the date the workbook was made written in the sheet somewhere. A macro that runs when the file is opened could then check if the current date is 30 days after the creation date, set a password and force the file closed. However that solution has some downsides, such as requiring that somebody try to open the file before the passwords get set.
The most secure way would be if you could password protect the files without opening them. But I don't think that would be an Excel solution, it would have to happen at the windows level.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To clarify. I would set the expiration date in code.
I'd like a password added to the file on a particular date.
I'd like a password added to the file on a particular date.
ASKER
wow, that's perfect.. and small code...
Thanks much.
Mark
Thanks much.
Mark
Glad I could help.
Are links to other Forums allowed, I was told not! Apparently I am not even allowed to link to my own site.
I've never had a problem before. I simply referenced what I found to not run into copyright issues.
Possibly with the workbook open event...
Private Sub Workbook_Open()
If Now > 42298 Then
ThisWorkbook.Protect Password:="SpongeBob"
End If
End Sub