My Excel program is protected, but I have a problem. I have to Unprotect the project when I do a certain task and then I would like to re-protect it from unwanted eyes/fingers. Can I do this in code? I tried this and it doesn't seem to work...
' We have to unprotect the project
VBAProject.ThisWorkbook.Unprotect password:="test123"
' do some stuff here
' Now re-protect the project
VBAProject.ThisWorkbook.Protect password:="test123"
' We have to unprotect the project
VBAProject.ThisWorkbook.Unprotect password:="test123"
' do some stuff here
' Now re-protect the project
VBAProject.ThisWorkbook.Protect password:="test123"