We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Prevent save in Calc with a macro [closed]

asked 2013-04-18 14:06:35 +0200

fs gravatar image

updated 2014-01-16 01:52:48 +0200

razon_22 gravatar image

When a user clicks 'save' button, I need to do some validation in macro, if it's invalid, then cannot save the document. How can I prevent saving using a macro?

Thanks in advance!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-18 14:42:44.267704


Hi, I have the same question and I think the answer is insufficient. It's right that I can asign a macro to the event "onsave", but I can't prevent saving the document.

function onsave(oEvent as object) oEvent.Source.disableSetModified() onsave=false end function

This prevent saving the document until you close the document. Then appears the question "Document was modified. Save, discard or cancel?" If you click "save" the document will be saved anyway.

Any ideas how to solve this problem?

heike84 gravatar imageheike84 ( 2016-08-16 11:54:50 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-01-16 04:58:00 +0200

m.a.riosv gravatar image

In Menu/Tools/Customize/Events you can assign a macro to "Save document" event.

edit flag offensive delete link more

Question Tools


Asked: 2013-04-18 14:06:35 +0200

Seen: 232 times

Last updated: Jan 16 '14