|
Sub 批量解除密码()
Application.ScreenUpdating = False: Application.DisplayAlerts = False
Dim mypath$, myfile$, i%, wb As Workbook, myname$, wkb As Workbook
Set wb = ThisWorkbook: mypath = wb.Path & "\"
myfile = Dir(mypath & "*.xls*")
Do While myfile <> ""
If myfile <> wb.Name Then
myname = Left(myfile, VBA.InStr(myfile, ".") - 1)
i = Application.WorksheetFunction.Match(myname, wb.Sheets(1).Range("c:c"), 0)
Workbooks.Open mypath & myfile, , , , wb.Sheets(1).Range("d" & i).Value
Set wkb = ActiveWorkbook
With wkb
.Password = ""
.Save
.Close False
End With
End If
myfile = Dir
Loop
MsgBox "当前文件夹内的工作簿的密码已被全部清除!", , ""
Application.Quit
Application.ScreenUpdating = True: Application.DisplayAlerts = True
End Sub
|
评分
-
1
查看全部评分
-
|