jenmcclary
Programmer
I have a directory with numerous excel files some of these files are password protected. I will be moving all of these files into 2 different directories. One directory will hold the password protected files, the other directory will hold the files with no protection.
Dim FileName As String
Dim mainWB As Workbook
Set mainWB = ActiveWorkbook
FileName = "C:\AA\Bill\HasPassword\The Rockefeller Foundation.xls"
Workbooks.Open FileName:=FileName
If ActiveWorkbook.HasPassword = True Then
MsgBox "Has Password"
Else
MsgBox "No Password"
End If
ActiveWindow.Close
This doesn't work because the excel workbook hangs waiting for you to enter a password. I don't want to enter a password I just want to see if the file has password protection and then move it. I have the moving part under control I just need help with checking for password protection.