![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 63
|
One of my friend keeps forgetting password
after protecting a workbook I want to write a VBA which will find the password for that workbook. Can someone help me out. |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
|
Is the file protected, or are the sheets protected ?
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Posts: 63
|
The file is protected.
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Cape Town,South Africa
Posts: 234
|
Try this dear :D
This is a code that use to protect worksheets ,you can change it if you want to. Private Sub Worksheet_Change(ByVal Target As Range) ' ' Macro by Gareth Lombard ' Application.EnableEvents = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="????????" Application.EnableEvents = True End Sub This code gos on the module: Sub myUnLock() 'This code will unprotect the sheet. Application.EnableEvents = False Application.DisplayAlerts = False ActiveSheet.Unprotect ("???????") 'Add optional code here! Application.EnableEvents = True Application.DisplayAlerts = True End Sub :o _________________ If you can help a friend in need,you are a friend indeed SO~ if you can help you do so. Ò¿Ó⌐ [ This Message was edited by: gareth on 2002-04-25 04:20 ] |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: Cape Town,South Africa
Posts: 234
|
Please note where the question marks is there the password goes.Please edit.
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
|
I don't know of any "code" to get the workbook password ( I have some that will strip the passwords from read-only files & protected sheets ), but there is an application available ( for a fee ) from :
http://www.elcomsoft.com/avpr.html Which lets you "see" the password for XL97. For newer versions of XL it only lets you change the password. |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Posts: 63
|
Can u give the code for stripping the
sheet/read only file password I dont want any application which will remove or show password. Instead i want a code which will remove or show me the password [ This Message was edited by: sree_31 on 2002-04-25 05:17 ] |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
|
If this doesn't appear correctly on the message board then feel free to drop me a note directly.
Sub sheet_BreakIt() Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer Dim i1 As Integer, i2 As Integer, i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer On Error Resume Next For i = 65 To 66 For j = 65 To 66 For k = 65 To 66 For l = 65 To 66 For m = 65 To 66 For i1 = 65 To 66 For i2 = 65 To 66 For i3 = 65 To 66 For i4 = 65 To 66 For i5 = 65 To 66 For i6 = 65 To 66 For n = 32 To 126 ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) If ActiveSheet.ProtectContents = False Then Exit Sub End If Next n Next i6 Next i5 Next i4 Next i3 Next i2 Next i1 Next m Next l Next k Next j Next i End Sub Sub workbook_breakIt() Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer Dim i1 As Integer, i2 As Integer, i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer On Error Resume Next For i = 65 To 66 For j = 65 To 66 For k = 65 To 66 For l = 65 To 66 For m = 65 To 66 For i1 = 65 To 66 For i2 = 65 To 66 For i3 = 65 To 66 For i4 = 65 To 66 For i5 = 65 To 66 For i6 = 65 To 66 For n = 32 To 126 Workbook.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) If ActiveSheet.ProtectContents = False Then Exit Sub End If Next n Next i6 Next i5 Next i4 Next i3 Next i2 Next i1 Next m Next l Next k Next j Next i End Sub |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Apr 2002
Posts: 63
|
Thanks a ton
But can u explain me in detail how it works |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
Hi
some ideas. protect without password? ok not so good but many office staff wont have a clue to reverse ths. the 65 and 66 code doed work it takes advantage of excels usless protection and attacks the passwork field and so gives up its secrets. does work i have tested it, its been kicking about for 18 months, who really wrote it i dont know, put the code in the module in VBA.. or should i say VB editora nd run.. WARNING can take ages *weeks* even.....
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|