![]() I have searched for a solution in Andrew Pitonyak’s ‘ Macros explained’ and also the OpenOffice documention but to no avail. It strikes me as odd that when calling the ‘protect("")’ method there is no way to specify ‘Allow all users of this sheet to: Select unprotected’ as there is when using the dialog. ![]() The result is that all cells are still selectable but attempts to edit even the unprotected cells produces a dialog box “Protected cells cannot be modified” I have also tried Locking Cells as each is filled with data: *sheet.getCellByPosition(5,row).CellProtection.IsLocked = FALSE* columns(6).CellProtection.IsLocked = FALSE columns(5).CellProtection.IsLocked = FALSE columns(4).CellProtection.IsLocked = FALSE My attempt at achieving this effect with a macro is as follows: The effect of this is as I would expect:- No protected cells can even be selected, let alone altered, but unprotected cells are selectable/editable. Then going to Tools → Protect Sheet and ticking under 'Allow all users of this sheet to: Select unprotected cells, leaving all other options unticked. Viz Format Cells → Cell Protection ->Protected Tick box ticked for those cells to protect and unticked for those cell that can be edited. I am trying to implement cell protection using a macro that would work exactly as it does using the 2 protection dialogs.
0 Comments
Leave a Reply. |