Must fill cell before closing

Is there a way to force a cell to be filled before closing a file? Like some kind of message telling me that “X” cell isn’t filled.

You need to write a macro and assign it to the document event
"Document is going to be closed".
This requires sensitive and sensible decicions.
A primitive example is attached. You can only run the contained macro if the execution of document macros is permitted. (Be careful!)
beforeClose.ods (10.1 KB)

to interrupt the Save process;
can’t see an effect of the boolean return code.


seems a bit more gory with Basic → How to trigger event with LibreOffice API to respond when closing a document? - #7 by mikekaganski

Wow, that seems complicated.:astonished:! I thought there was a simple solution.

Writing a macro that listens for events related to closing a file (either a specific file or all files) is easy.
The difficulty arises if you want to cancel the file close and your macro is written in Basic, since Basic doesn’t have native constructs for raising named exceptions.

Sorry, too complicated for me, written in Basic? Don’t know Basic, all I know it’s a computer language or something like that.