When shared workbook has protected, if you want to do any modifications we need to unshared and unprotect workbook at the beginning of the procedure to do any changes to the workbook. If you forgot the password, you cannot unshared or unprotect the workbook.
Why we need to UnProtectSharing a Workbook using VBA?
If workbook is shared and protected with password to do any modifications like edit, move and change first we have to unprotect sharing workbook and unprotect workbook then only user can do any modifications in the workbook. We cannot protect or unprotect workbook when a workbook is shared.
VBA UnProtectSharing Workbook – Syntax
Here is the syntax to UnprotectSharing workbook using VBA.
Workbooks(“Your Workbook Name”).UnprotectSharing(