#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Unlock VBE

Is there any new information on how to unlock a VBE Project when you don't
know the password? I've tried Bill Manvilee's code but even though I've got
the extensibility checked, I can't even assign that UnprotectVBProject macro
to anything (macro doesn't show up on the list of available macros). I can
run the "test" macro ok, but it just comes up asking for a password to th
NSC.xls VBE.

Code used is as follows:
Sub test()
UnprotectVBProject Workbooks("NSC.xls"), "password"
End Sub

Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
'
' Bill Manville, 29-Jan-2000
'
Dim VBP As VBProject, oWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer

Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook

If VBP.Protection < vbext_pp_locked Then Exit Sub

Application.ScreenUpdating = False

' Close any code windows To ensure we hit the right project
For Each oWin In VBP.VBE.Windows
If InStr(oWin.Caption, "(") 0 Then oWin.Close
Next oWin

WB.Activate
' now use lovely SendKeys To unprotect
Application.OnKey "%{F11}"
SendKeys "%{F11}%TE" & Password & "~~%{F11}", True

If VBP.Protection = vbext_pp_locked Then
' failed - maybe wrong password
SendKeys "%{F11}%TE", True
End If

' leave no evidence of the password
Password = ""
' go back To the previously active workbook
wbActive.Activate

End Sub

Thanks, Brett
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Unlock VBE

Bill's code relies on you knowing the password.

If you don't know the password, then I wouldn't think this approach would be
very effective.

Brettjg wrote:

Is there any new information on how to unlock a VBE Project when you don't
know the password? I've tried Bill Manvilee's code but even though I've got
the extensibility checked, I can't even assign that UnprotectVBProject macro
to anything (macro doesn't show up on the list of available macros). I can
run the "test" macro ok, but it just comes up asking for a password to th
NSC.xls VBE.

Code used is as follows:
Sub test()
UnprotectVBProject Workbooks("NSC.xls"), "password"
End Sub

Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
'
' Bill Manville, 29-Jan-2000
'
Dim VBP As VBProject, oWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer

Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook

If VBP.Protection < vbext_pp_locked Then Exit Sub

Application.ScreenUpdating = False

' Close any code windows To ensure we hit the right project
For Each oWin In VBP.VBE.Windows
If InStr(oWin.Caption, "(") 0 Then oWin.Close
Next oWin

WB.Activate
' now use lovely SendKeys To unprotect
Application.OnKey "%{F11}"
SendKeys "%{F11}%TE" & Password & "~~%{F11}", True

If VBP.Protection = vbext_pp_locked Then
' failed - maybe wrong password
SendKeys "%{F11}%TE", True
End If

' leave no evidence of the password
Password = ""
' go back To the previously active workbook
wbActive.Activate

End Sub

Thanks, Brett


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Unlock VBE

Thanks Dave, bugger it!

"Dave Peterson" wrote:

Bill's code relies on you knowing the password.

If you don't know the password, then I wouldn't think this approach would be
very effective.

Brettjg wrote:

Is there any new information on how to unlock a VBE Project when you don't
know the password? I've tried Bill Manvilee's code but even though I've got
the extensibility checked, I can't even assign that UnprotectVBProject macro
to anything (macro doesn't show up on the list of available macros). I can
run the "test" macro ok, but it just comes up asking for a password to th
NSC.xls VBE.

Code used is as follows:
Sub test()
UnprotectVBProject Workbooks("NSC.xls"), "password"
End Sub

Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
'
' Bill Manville, 29-Jan-2000
'
Dim VBP As VBProject, oWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer

Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook

If VBP.Protection < vbext_pp_locked Then Exit Sub

Application.ScreenUpdating = False

' Close any code windows To ensure we hit the right project
For Each oWin In VBP.VBE.Windows
If InStr(oWin.Caption, "(") 0 Then oWin.Close
Next oWin

WB.Activate
' now use lovely SendKeys To unprotect
Application.OnKey "%{F11}"
SendKeys "%{F11}%TE" & Password & "~~%{F11}", True

If VBP.Protection = vbext_pp_locked Then
' failed - maybe wrong password
SendKeys "%{F11}%TE", True
End If

' leave no evidence of the password
Password = ""
' go back To the previously active workbook
wbActive.Activate

End Sub

Thanks, Brett


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Unlock VBE

Yes, this should be your password :)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Unlock K New Users to Excel 4 February 2nd 07 09:45 PM
Unlock for Viewing Edmund Excel Worksheet Functions 0 May 2nd 06 05:08 AM
Unlock VBA project Tomasz Klim Excel Discussion (Misc queries) 0 October 10th 05 03:43 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM
How do I unlock a document? babyjjl Excel Discussion (Misc queries) 1 November 30th 04 10:47 PM


All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"