The macro code below is meant to:
- select the sheet DATA1 in the current document
- unprotect the sheet with the password 1234
- turn off cell protection for the range T7:T4326
- protect the sheet with password 1234
However, after running, no cells in the specified range are unprotected.
Where am I going wrong?
Thank you in advance.
Sub UnprotectRange
Dim oDoc As Object
Dim oSheet As Object
Dim oRange As Object
oDoc = ThisComponent
oSheet = oDoc.getSheets().getByName("DATA1")
oSheet.unprotect("1234")
oRange = oSheet.getCellRangeByName("T7:T4326")
oRange.CellProtection.IsLocked = False
oSheet.protect("1234")
End Sub