Hello
I want to password protect all excel files in a folder with different password,
code should go to the url in the filename column and assign password in the password column
let say for file path in Cell B2 should be assigned with password in e2 file path in Cell B3 should be assigned with password in E3...etc
i tried the below code , but couldnt able to get
Code
Sub PasswordExcelFilesInFolder2()
Dim wb As Workbook
Dim c As Range, d As Range
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
For Each c In Range(Range("S2"), Range("s2").End(xlDown))
For Each d In Range(Range("P2"), Range("P2").End(xlDown))
Range("T10").Value = c.Value
Range("U10").Value = d.Value
Workbooks("protectworkbookusingvba.xlsm").Worksheets("Sheet1").Activate
pwd = c.Value
ActiveWorkbook.FollowHyperlink Address:=d.Value, NewWindow:=False, AddHistory:=True
ActiveWorkbook.SaveAs Filename:=Application.ActiveWorkbook.FullName, Password:=pwd
ActiveWorkbook.Close True
Next
Next
MsgBox "Task Complete!"
ResetSettings:
With Application
.EnableEvents = True
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub
Display More