Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I had to do some digging recently to try and find the answer to this,
and while I did find a couple good leads, the code wasn't *quite* right. So, for the benefit of someone else trying to attempt to do this crazy thing, I thought I'd post the code here. (Really, it's NOT an ego thing...just trying to give back a little.) NOTE: The constant "conPW " is the password to be used on the project. The value is stored with the project at save/close, so locking the doors when you leave isn't necessary. Public Sub UnprotectVBAProject() 'This has been tested in E97 only. On Error GoTo ErrHandler Const conPW as String = "MyPassword" 'Open VBE Call SendKeys("%{F11}", True) 'Open Project Explorer Call SendKeys("%(V)P", True) 'PageUp 5 times to be sure "VBAProject" is selected Call SendKeys("{PGUP 5}", True) 'Hit Enter to give prompt, enter PW and Enter again. Call SendKeys("{ENTER}" & conPW & "{ENTER}", True) ExitProcedu Exit Sub ErrHandler: Select Case Err.Number Case Else Application.ScreenUpdating = True MsgBox Err.Number & vbNewLine & Err.Description, vbCritical Resume ExitProcedure Resume End Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Anthony Cuttitta Jr." wrote in message om... I had to do some digging recently to try and find the answer to this, and while I did find a couple good leads, the code wasn't *quite* right. So, for the benefit of someone else trying to attempt to do this crazy thing, I thought I'd post the code here. (Really, it's NOT an ego thing...just trying to give back a little.) NOTE: The constant "conPW " is the password to be used on the project. The value is stored with the project at save/close, so locking the doors when you leave isn't necessary. Public Sub UnprotectVBAProject() 'This has been tested in E97 only. On Error GoTo ErrHandler Const conPW as String = "MyPassword" 'Open VBE Call SendKeys("%{F11}", True) 'Open Project Explorer Call SendKeys("%(V)P", True) 'PageUp 5 times to be sure "VBAProject" is selected Call SendKeys("{PGUP 5}", True) 'Hit Enter to give prompt, enter PW and Enter again. Call SendKeys("{ENTER}" & conPW & "{ENTER}", True) ExitProcedu Exit Sub ErrHandler: Select Case Err.Number Case Else Application.ScreenUpdating = True MsgBox Err.Number & vbNewLine & Err.Description, vbCritical Resume ExitProcedure Resume End Select End Sub Am I being simplistic, or does that mean that in order to break the password on my VBA Projects, all someone has to do, is run that code inside a loop, trying various values of conPW? Surely it cannot be that trivial to unlock a project or am I just being naive? Alan. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Alan" wrote in message ...
"Anthony Cuttitta Jr." wrote in message om... I had to do some digging recently to try and find the answer to this, and while I did find a couple good leads, the code wasn't *quite* right. So, for the benefit of someone else trying to attempt to do this crazy thing, I thought I'd post the code here. (Really, it's NOT an ego thing...just trying to give back a little.) NOTE: The constant "conPW " is the password to be used on the project. The value is stored with the project at save/close, so locking the doors when you leave isn't necessary. [snip] Am I being simplistic, or does that mean that in order to break the password on my VBA Projects, all someone has to do, is run that code inside a loop, trying various values of conPW? Surely it cannot be that trivial to unlock a project or am I just being naive? Alan. Actually, my guess is that you're right. Good passwords are the key (at least if your code is critical). Nothing is hackproof. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Anthony Cuttitta Jr." wrote in message
om... Am I being simplistic, or does that mean that in order to break the password on my VBA Projects, all someone has to do, is run that code inside a loop, trying various values of conPW? Surely it cannot be that trivial to unlock a project or am I just being naive? Alan. Actually, my guess is that you're right. Good passwords are the key (at least if your code is critical). Nothing is hackproof. Agreed - but this seemed a little too simple for my liking. I tried to code it, but it is not quite as simple as it seems (or perhaps I am too simple...) Alan. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Alan" wrote in message ...
"Anthony Cuttitta Jr." wrote in message om... Actually, my guess is that you're right. Good passwords are the key (at least if your code is critical). Nothing is hackproof. Agreed - but this seemed a little too simple for my liking. I tried to code it, but it is not quite as simple as it seems (or perhaps I am too simple...) Alan. Has to be run from a command button on the spreadsheet. Can't run from debug. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Anthony Cuttitta Jr." wrote in message
om... Has to be run from a command button on the spreadsheet. Can't run from debug. I was running it as a sub from Tools - Macros - Run from a worksheet, mainly since the first command was to open the VBE, which meant, implicitly, I had to start from outside the VBE. Why does it *have* to be run from a command button? Does that make a difference? Thanks, Alan. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excell error "Can't find Project or Library" Project VBAProject | Excel Worksheet Functions | |||
How to convert MS Project to MS Excel. I don't have MS Project. | Excel Discussion (Misc queries) | |||
Unprotecting! | Excel Programming | |||
Unprotecting! | Excel Programming | |||
Accesing vba project from wb that has vba project password protected | Excel Programming |