Password: Its Optional argument. It specifies a case sensitive password for the workbook. When you want to unprotect your protected workbook you must specify your password. In the above syntax we are using ‘UnprotectSharing’ method of workbook object to unshare the workbook.
VBA UnProtectSharing Workbook:Example 1
Please find the below example, It will show you how to Unprotect workbook from sharing.
In the above example we are unprotecting sharing the workbook by using ‘UnprotectSharing’ method of Workbook object in the active workbook. When working with workbook if it has password protected and shared, if you want to do any changes in the code first you have to unshared and unprotect the password at the beginning of the procedure.
VBA UnProtectSharing Workbook – Instructions
Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:
- Open an Excel Workbook
- Press Alt+F11 to Open VBA Editor
- Insert a Module from Insert Menu
- Copy the above code for activating a range and Paste in the code window(VBA Editor)
- Save the file as macro enabled workbook
- Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.