Hi, thanks for your help but I think i solved my problem. Here's the solution to it. Have a new sheet which store password for all the different workbooks and then add it into the for loop
Dim RowNum As Integer
RowNum = 2
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "G:\Test\Test"
.FileType = msoFileTypeExcelWorkbooks
.Filename = "Book*.xls"
If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count
pwd = Sheets("PasswordTable").Range("B" & RowNum).Value
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0, Password:=pwd)
'MY CODE
wbResults.Close SaveChanges:=True
RowNum = RowNum + 1
Next lCount
End If
End With
Bookmarks