Home > Software engineering > Batch remove password Excel VBA code? To solve problems is pointed out that code, modify the code
Batch remove password Excel VBA code? To solve problems is pointed out that code, modify the code
Time:09-16
I to solve the question now is: I have a lot of excel files in the same folder, file has the same password and I know, I want to remove all the password, make each excel file directly to open the file, the sheet is in the excel file without password, I see a code in baidu knows, is to decrypt the excel files in the local folders, but I according to its operation without success, hope to have a master to help me take a look at how to modify the can realize my demand, thank!!!!!!
Reference: https://zhidao.baidu.com/question/2117910715489312707.html -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Xx (Sub) Dim PTH, fn, I, j, n PTH=ThisWorkbook. Path & amp; "" Fn=Dir (PTH & amp; "*. XLS") The Do While fn & lt;> " "If fn & lt;> ThisWorkbook. Name Then Application. The Workbooks. Open PTH & amp; Fn N=Workbooks (fn). Sheets. Count For j=1 To n Workbooks (fn) Sheets (j) Unprotect "TZHJTDWIVSBWYKU "Next Application. Workbooks (fn). Close True End the If Fn=Dir Loop End Sub Create a new excel file, Alt + F11 opened the VBE varies, create a new module, copy the code above, exit the VBE varies, keep the excel file to decrypt the folder, performs macro xx _______________________________________________________________________________________________________________________
CodePudding user response:
Recording a macro, and then change, iterate over all the files