How can I programmatically remove a (known) password from an Excel VBA project?
To be clear; I want to remove the password from the VBA Project, not the workbook or any worksheets.
How can I programmatically remove a (known) password from an Excel VBA project?
To be clear; I want to remove the password from the VBA Project, not the workbook or any worksheets.
In VBA use
ActiveWorkbook.Unprotect (Password)
EDIT: There is an ActiveWorkbook.VBProject.Protection
property, but it is ReadOnly. So I guess the answer is: You can't. Sorry.
This has a simple method using SendKeys to unprotect the VBA project. This would get you into the project, so you'd have to continue on using SendKeys to figure out a way to remove the password protection: http://www.pcreview.co.uk/forums/thread-989191.php
And here's one that uses a more advanced, somewhat more reliable method for unprotecting. Again, it will only unlock the VB project for you. http://www.ozgrid.com/forum/showthread.php?t=13006&page=2
I haven't tried either method, but this may save you some time if it's what you need to do...
Did some googling - it seems there is no direct way - you have to use a sendkeys kludge
As others have said, you can't outside of using SendKeys.
However I tried using SendKeys with Excel 2002 and never got it to work.
If there are just a few projects you can open them and then select them programmatically, but you'll still have to click on each and enter the password.