Force Edit Protected View Excel VBA (Visual Basic for Applications)

Force Edit Protected View Excel VBA (Visual Basic for Applications)

ProtectionView

Object which is a read-only mode where editing contents are disabled in a workbook. User can navigate through workbook when Protected View is on. Following example will loop through each protected view windows collection and enables force editing:

Code example

Public Sub EditProtect()
    'Declare workbook object
    Dim oWorkbook As Workbook
	
    'Bind workbook reference
    Set oWorkbook = ActiveWorkbook
    
    'Declare ProtectedViewWindow object
    Dim oProtectedViewWindow As ProtectedViewWindow
	
    'Iterate each ProtectedViewWindow
    For Each oProtectedViewWindow In Application.ProtectedViewWindows
    
    'Activate window
        oProtectedViewWindow.Activate

        'Force edit view
        oProtectedViewWindow.Edit

    Next oProtectedViewWindow
	
	'Memory cleanup
	Set oWorkbook = Nothing
	Set oProtectedViewWindow = Nothing
End Sub

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Leave a Reply

Your email address will not be published. Required fields are marked *