C
Crookie74
I'm trying to find a way to programmatically check if a workbooks VBA
project has protection.
I know ActiveWorkbook.VBProject.Protection will tell you if it is
currently locked but that doesn't help if the project has already been
unprotected ie by a user (or another bit of code) has unprotected the
project.
So what i am trying to do is if a VBA project doesn't have any
protection, my code will ask the user for a password and then set the
password by using sendkeys. If they already have the VBA project
protected, it will ask them for their password, then unlock the
project using sendkeys. My problem is when a user opens up the
workbook, manually opens the VBA code by entering the VBA password. If
my code is then run ActiveWorkbook.VBProject.Protection will return 0.
If I had a way to know the VBA project was password protected but
currently unlocked, then i would not need to ask the user for a
password.
Any help would be appreciated.
project has protection.
I know ActiveWorkbook.VBProject.Protection will tell you if it is
currently locked but that doesn't help if the project has already been
unprotected ie by a user (or another bit of code) has unprotected the
project.
So what i am trying to do is if a VBA project doesn't have any
protection, my code will ask the user for a password and then set the
password by using sendkeys. If they already have the VBA project
protected, it will ask them for their password, then unlock the
project using sendkeys. My problem is when a user opens up the
workbook, manually opens the VBA code by entering the VBA password. If
my code is then run ActiveWorkbook.VBProject.Protection will return 0.
If I had a way to know the VBA project was password protected but
currently unlocked, then i would not need to ask the user for a
password.
Any help would be appreciated.