Hello!
I would like to lock a cell in order to prevent that the user could write in,
I use the command oCell.cellprotection.isLocked = True/False but don’t run,
Can You help me?
Thank you
Have a nice day
P.S. I tried to use the command:
cp = createUnoStruct(“com.sun.star.sheet.CellProtection”)
Dim cp as new com.sun.star.sheet.CellProtection
but nothing happens
News: I don’t understand whi this code don’t run
Sub test(pPass$, kj#)
oSheet = ThisComponent.getSheets().getbyname("Prova")
oSheet.UnProtect(pPass)
oCellRange = oSheet.GetcellRangebyname("Data")
oCell = oCellRange.getCellByPosition(2,6)
select case kj
case 1
oCell.cellbackcolor = RGB(255,255,0)
hh = oCell.CellProtection
hh.IsLocked = False
oCell.CellProtection = hh
case 2
oCell.clearContents(1)
oCell.cellbackcolor = RGB(255,255,255)
hh = oCell.CellProtection
hh.IsLocked = True
oCell.CellProtection = hh
end select
oSheet.Protect(pPass)
End Sub