I get an error from the following sub: Basic runtime error: an exception occurred. Type: com.sun.star.util.CloseVetoException. What's the problem.
Thanks for the help. Here is the sub:
dim oDoc as object
oDoc = ThisComponent
If hasUNOInterfaces(oDoc,"com.sun.star.util.XCloseable") then
oDoc.close(true)
else
oDoc.dispose()
End If
End Sub
[SOLVED] CloseVetoException
[SOLVED] CloseVetoException
Last edited by floris v on Thu May 07, 2015 8:41 am, edited 2 times in total.
Reason: Added green checkmark for Solved, edited Solved tag
Reason: Added green checkmark for Solved, edited Solved tag
Libre Office 4.2.2.1 on OS X 10.9.3
Re: CloseVetoException
It's a bad idea for a document to try to close itself. If your macro opens an "outside" document then it can close this outside document without any effect on the document the macro is "running out of" and that's fine. Or you can run script from outside of OpenOffice that opens and closes OpenOffice documents. But if a macro is running from inside a document and tries to close that document, you get a chicken-and-egg problem: the document can't close until the macro finishes running, and the macro can't finish running until the document is closed.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
SOLVED Re: CloseVetoException
Thanks for your direction. I'll throw a different path.
Libre Office 4.2.2.1 on OS X 10.9.3
-
- Volunteer
- Posts: 1160
- Joined: Mon Oct 08, 2007 1:26 am
- Location: France, Paris area
Re: CloseVetoException
It depends. You must have nothing pending when you close.MTP wrote:It's a bad idea for a document to try to close itself.
A case that comes to my mind : if your macro works in a dialog, you cannot close the document since the dialog is not yet closed. Close the dialog first, then close the document.
Another case : you have started a printout and you try to close before it is finished.
Bernard
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Re: [SOLVED] CloseVetoException
This macro is triggered from a button on a form. I'm done with the form an want to close it. What's creating the error?
Libre Office 4.2.2.1 on OS X 10.9.3
-
- Volunteer
- Posts: 1160
- Joined: Mon Oct 08, 2007 1:26 am
- Location: France, Paris area
Re: [SOLVED] CloseVetoException
.odb documents are special beasts...
How to close the current form from the button, but keep the Base document open :
How to close the form and close the Base document :
How to close the current form from the button, but keep the Base document open :
Code: Select all
Sub closeThisForm
StarDesktop.CurrentFrame.close(True)
End Sub
Code: Select all
Sub closeFormAndBase
ThisDatabaseDocument.close(True)
End Sub
Bernard
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1