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.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Scott CConnect With a Mentor Senior Systems EnginerCommented:
Scott CSenior Systems EnginerCommented:
So you don't want the document to be able to be opened UNTIL 30/60 days have passed and then only with a password?

Possibly with the workbook open event...

Private Sub Workbook_Open()
If Now > 42298 Then
    ThisWorkbook.Protect Password:="SpongeBob"
End If
End Sub
Brian BEE Topic Advisor, Independant Technology ProfessionalCommented:
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.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

drelingerAuthor Commented:
To clarify.  I would set the expiration date in code.
I'd like a password added to the file on a particular date.
drelingerAuthor Commented:
wow, that's perfect.. and small code...
Thanks much.
Scott CSenior Systems EnginerCommented:
Glad I could help.
Roy CoxGroup Finance ManagerCommented:
Are links to other Forums allowed, I was told not! Apparently I am not even allowed to link to my own site.
Scott CSenior Systems EnginerCommented:
I've never had a problem before.  I simply referenced what I found to not run into copyright issues.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.