I am having some problems with installing a progress bar indicator to the following macro. The macro listed below removes the passwords from all the worksheets within the selected workbook. It sometimes takes a little while to run and would like to install a stand-alone progress bar.
Please help! I can make a progress bar to run but it is dependent on a time interval, I cannot seem to figure this out. Thank you very much to whomever can help me.
Sub ShowPasswordBreakerDialog()
Dim InvalidContext As Boolean
Dim I As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
Const DBLSPACE As String = vbNewLine & vbNewLine
Const VERSION As String = DBLSPACE & "Version 1.1.1 2011-Apr-19"
Const AUTHORS As String = DBLSPACE & vbNewLine & _
"Creator: Cameron O'Neill"
Dim RunVarification As String
Dim WSheet As Worksheet
Dim ShTag As Boolean, WinTag As Boolean
On Error Resume Next
If Val(Application.VERSION) < 12 Then
MsgBox "This utility requires Excel 2007 or later.", vbCritical
Exit Sub
End If
If ActiveSheet Is Nothing Then InvalidContext = True
If TypeName(ActiveSheet) <> "Worksheet" Then InvalidContext = True
If InvalidContext Then
MsgBox "Please select an active workbook in order to" & vbCrLf & "optimize the Password Breaker utility." & AUTHORS & VERSION, vbCritical, APPNAME
Else
RunVarification = MsgBox("Are you sure you would like to run the Password Breaker Utitlity?" & vbCrLf & "This will remove the password within in the selected worksheet." & AUTHORS & VERSION, vbYesNo + vbInformation, "Varification Prompt")
If ActiveSheet.ProtectContents = False Then
MsgBox "There are no passwords installed on the current workbook." & vbCrLf & "Please select a workbook with passwords installed to" & vbCrLf & "optimize the All Password Breaker utility." & AUTHORS & VERSION, vbOKOnly + vbInformation, APPNAME
Exit Sub
Else
With ProgressIndicator
.LabelProgress.Width = 0
.Show
If RunVarification = vbYes Then
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
'This section unprotects the active sheet that is selected
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)
'This section gives the password sugestion
If ActiveSheet.ProtectContents = False Then
MsgBox "Password Breaker has ran sucsessfully." & vbCrLf & "Current sheets password has been removed." & AUTHORS & VERSION, vbInformation, APPNAME
Exit Sub
End If
'This section loops through the worksheet
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
ElseIf RunVarification = vbNo Then
Exit Sub
End If
End With
End If
End If
Bookmarks