A
aaronfude
Hi,
I'm using the following code (which I found in this news group) to have
the project unprotect itself
Sub UnprotectVBProject(ByVal Password As String)
Dim vbProj As Object
Set vbProj = ThisWorkbook.vbProject
If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
SendKeys "MyPassword" & "~~"
Application.VBE.CommandBars(1).FindControl(id:=2578,
recursive:=True).Execute
End Sub
but two bad things happen:
1. It prompts for the password anyway.
2. Whatever code follows the call to the sub does not wait for this sub
to exit, but proceeds to execute and fails b/c the project is still
protected.
How can I solve each problem?
Very many thanks in advance!
Aaron Fude
I'm using the following code (which I found in this news group) to have
the project unprotect itself
Sub UnprotectVBProject(ByVal Password As String)
Dim vbProj As Object
Set vbProj = ThisWorkbook.vbProject
If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
SendKeys "MyPassword" & "~~"
Application.VBE.CommandBars(1).FindControl(id:=2578,
recursive:=True).Execute
End Sub
but two bad things happen:
1. It prompts for the password anyway.
2. Whatever code follows the call to the sub does not wait for this sub
to exit, but proceeds to execute and fails b/c the project is still
protected.
How can I solve each problem?
Very many thanks in advance!
Aaron Fude