Protected sheets and macro

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

Mr.Crocodile gravatar image

updated 2015-09-27 18:33:01 +0200

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 close merge delete