UnProtectSharing Method of Workbook Object VBA

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.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


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(

[SharingPassword])

Where
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.


Sub Unprotect_Sheet()
ActiveWorkbook.UnprotectSharing “YourPassword”
End Sub

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:

  1. Open an Excel Workbook
  2. Press Alt+F11 to Open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code for activating a range and Paste in the code window(VBA Editor)
  5. Save the file as macro enabled workbook
  6. Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.
LIMITED TIME OFFER

Leave A Comment


Related pages


unprotect password protected excel sheettrim function in excel 2007excel vba filter rangeddl and dml in dbmsmeeting minutes template microsoft wordexcel vba last cellvba excel easypivot table in sql server examplehow to create workbook in excelcall excel function in vbatesting interview questions for fresherswriting vba macrosexcel vba collectionexcel 2007 countifsvba filesystemobjectddl sqltcl commands in sql server with examplesproject reporting template excelopen file in excel vbaforgot password on protected excel sheethyperlink excel vbaexcel col_index_numexcel dashboard tutorialsneat excel tricksvba copy filematch function excel 2007use of vlookup and hlookup in excelvlookup case sensitivevlookup example in exceldelete blank rows excelexcel 2010 unhide worksheetvba code to insert data into access tablehow to delete duplicate information in excelhow do you unhide columns in excel 2010excel write macroshortcut for inserting a row in excelsave a workbook vbahlookup excel functionwhat is meant by vlookup in excelsumifs formula in excelvisual basic trim functionhow to pivot table excel 2013array macro excelmerge columns in excel 2007pivot table graphsql query excelhow to unhide rowsexcel find duplicate recordsread text file vbadrop down list excel 2007how to create dashboard in excel 2007vba excel sort columnexcel unhideexcel if statement with 2 conditionsexcel how to sort alphabeticallysql data definition commandsmicrosoft excel merge cellsblank excel worksheetexcel vba code if then statementexcel macros and vbaaccess vba checkboxdelete blank cells excelexcel vba with rangemicrosoft word add developer tab to ribbonfilesystemobject file existssample vba projectsms excel operatorsunhide all cellsdbms commands with examples pdfselect a range vbaopen excel file from access vbavlookup excel worksheetproject management tracking excelvba excel sort column