Macro to protect spreadsheet without UI popup

Hi.

I am trying to protect a Calc sheet while specifying some attributes, like allowing to select non-protected cell and disallowing the selection of cells that are protected.

These attributes are available via the user interface by right-clicking the sheet name and selecting those options. However, I would like to trigger those options in a macro without having the UI popup.

How could this be done?

I have attached a spreadsheet with an embedded macro, but it does not work.

Test_Protect_Sheet.ods (13.9 KB)

Any suggestions?

Thanks

JF

See container “Application Macros”, library “Tools”, module “Misc”, routine “ProtectSheets”