2

I'm having some trouble unprotecting a workbook's VBA project via code. The SendKeys method used to work pretty well, but in Windows 8 64-bit it doesn't work anymore. What could be the reason? Does someone know a different method for this environment?

Community
  • 1
  • 1
blitziken
  • 61
  • 1
  • 1
  • 8
  • 2
    I think MSFT may have figured out what a bad idea it was to allow this. See comment (in the link you made above): "As Richie(UK) has pointed out the only way is with SendKeys. _An accident just waiting to happen, IMHO._" (I added the emphasis). I consider myself a grade A hacker, yet even I shudder at the idea of doing this... So I'm kind of glad you can't anymore. – Floris Sep 03 '13 at 20:29
  • Thanks @Floris, I'm aware about the unconvenience of this method, but it was the only functional way to do the job. Now it seems like there isn't any way to do it. – blitziken Sep 03 '13 at 20:40
  • 2
    See if [THIS](http://stackoverflow.com/questions/16174469/unprotect-vbproject-from-vb-code) helps? – Siddharth Rout Sep 03 '13 at 20:41
  • Hi, thanks for the answer. I saw that approach before, but in my case its required that the code that unprotects the project, and the project itself have to be in the same workbook. – blitziken Sep 04 '13 at 14:14
  • @blitziken: if you use Sid's code it will be in the same project, just using API calls instead of native VBA. – Our Man in Bananas Oct 01 '13 at 08:11

1 Answers1

0

I had the same issue with Module password. However and i know this sounds a little twisted but the only way i could work out how to unprotect the module was to locally store a copy of the module unprotected, use code to remove the exiting module and export in the unprotected version, then make the changes required using VBA then do vise verse back again. utilizing the export and import function on the module. you'll need to store the protected and unprotected versions locally in separate folders.

Hope this helps!

Adrian Gornall
  • 327
  • 5
  • 12
  • 28