Protected sheets and macro [closed]

asked 2015-06-09 10:02:01 +0100

Mr.Crocodile gravatar image

updated 2020-08-21 23:42:41 +0100

Alex Kemp gravatar image

Windows 7 64bit LibreOffice 4.4.3.2 Working with Calc, I made a spreadsheet with some protected sheets (to prevent them to be accidentally modified). Now I noticed that, using a macro, it is possible to add values and text to the cells of the protected sheets but it is not possible to cancel them (using commands like .ClearContents(5)). I made some test using a portable version of OpenOffice 4.1.1 and I noticed that with this tool it is not possible at all to write or cancel cells from a protected sheet using a macro. Now IMO probably the protection of a sheet is useful to prevent accidental modification and not to prevent to write a cell at all. Some people said me that probably LibreOffice behaviour could be an anomaly, but at the moment I took advantage of it and I would know if in the future could became impossible at all to modify a cell by a macro when the sheet is protected. (I know that there is the .Protect - .Unprotect couple of commands to be used but it is not so comfortable when it is necessary to update a lot of cells in different situations during the execution of the sub routine.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-08-21 23:42:58.301395