Results 1 to 2 of 2
2002-12-16, 13:42 #1
- Join Date
- May 2002
- London, Gtr London, England
- Thanked 0 Times in 0 Posts
VBA Project Protection (Office 2000)
Does anyone know if you can change the password protection of a project of several templates all at once? We have a list of templates we want to change the password of but we don't want to have to open each template and change the password?
2002-12-17, 01:29 #2
- Join Date
- Dec 2000
- New York, NY
- Thanked 29 Times in 27 Posts
Re: VBA Project Protection (Office 2000)
It seems that a method to change the password protection of VBA projects is (intentionally) not exposed via code.
Set a reference to the VB Extensibility Library, and have a look in the object browser at the VB Project class in the VBIDE library - there is a Protection property, which is read-only.
The help for the Protection property says that it will return a value indicating whether the project is either locked or not - that seems to be as close as you can get through code (unless you want to start playing around with SendKeys).
It's a pain to have to change all those passwords manually, but it's probably better off that it's not programatically accessible - for one thing, that would make it much easier for someone to use a brute-force method to crack your project's password. (On the other hand, it seems that someone could bypass the password of your VBA project by simply opening the project in Star Office, but that's another matter!)