I have the following code, which does what it should but I wanted to add a clause to the last line to ignore all files that are password protected. There are a few hundred files, and pressing cancel on each one is tedious. It is not an option to use the password as an argument, so I am just trying to skip the protected workbooks.
With Application
.ScreenUpdating = False
.DisplayAlerts = False
.EnableEvents = False
On Error Resume Next
Set wbThis = ThisWorkbook
spname = "ERROR"
spid2 = "ERROR"
aCount = 0
With .FileSearch
.NewSearch
'Change path to suit
.LookIn = "C:\CP"
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count 'Loop through all.
'Open Workbook x and Set a Workbook variable to it
PlzWait.Show False
PlzWait.Label1.Caption = lCount
PlzWait.Label2.Caption = .FoundFiles.Count
DoEvents
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), ReadOnly:=True, UpdateLinks:=0)
Bookmarks