First, I am not trying to crack any passwords. I am, instead, trying to make sure that a large folder of excels all have been password protected. Obviously, the issue with something like the below is that I have to open the password protected wb to set the variable (which I can't do with a password protected book).
Any thoughts?
Any thoughts?
Code:
Sub IsWorkbookProtected()Dim wb As Workbook
Dim myPath
Dim myFile
myPath = "SomePath\"
Do While myFile <> ""
Set wb = Workbooks.Open(Filename:=myPath & myFile)
With wb
If .ProtectWindows Or .ProtectStructure Then
Debug.Print .PasswordEncryptionAlgorithm
Else
Debug.Print "This workbook is not password protected"
End If
End With
myFile = Dir
Loop
End Sub