Function GetPassword(ByVal Name As String) As String
a = 0
For i = 1 To Len(Name)
a = a + Asc(Mid(Name, i, 1))
Next i
GetPassword = a
End Function
Sub Ìàêðîñ1()
SrcPath = Application.ActiveWorkbook.Path
If SrcPath = "" Then Exit Sub
If Right(SrcPath, 1) <> "\" Then SrcPath = SrcPath & "\"
DstPath = SrcPath & "Без формул\"
On Error GoTo MkDirErr
MkDir ("Без формул")
MkDirErr:
Passwords$ = SrcPath & "passwords.txt"
Open Passwords$ For Output As #1
Close #1
sFile = FileSystem.Dir(SrcPath & "*.XLS")
Do While sFile <> ""
Workbooks.Open Filename:=SrcPath & sFile
pass$ = GetPassword(sFile)
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=DstPath & sFile, _
FileFormat:=xlNormal, Password:=pass$, _
ReadOnlyRecommended:=True, CreateBackup:=False
Application.DisplayAlerts = True
Open Passwords$ For Append As #1
Write #1, sFile & " " & pass$ & Chr(13) & Chr(10)
Close #1
sFile = FileSystem.Dir()
Loop
End Sub