[Solved] Command to Undo the entire Sub macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Math
Posts: 89
Joined: Mon Oct 29, 2018 6:32 pm

[Solved] Command to Undo the entire Sub macro

Post by Math »

I have multiple macros in a project. macro1, macro2, macro3 ........ macro20 ..... is there any BASIC command in LibreOffice that I can use to CANCEL the action of some of them? for example, I do not want to use macro4, macro13
  and macro17.

I would like some command to override the full macro action.

I DO NOT want to delete the macros that I will not use, I just want to undo the macro action, because in the future I can use the macro again.

Note:

I already know the REM command and the (') command, but these commands need to write in each line of the macro.

I would like a command to put only once at the beginning of the
Sub macro1, to NULL the action of the entire macro.

Is there any command ?


hugs.
Last edited by Math on Wed Nov 14, 2018 1:38 pm, edited 1 time in total.
LibreOffice 5.4.4.2 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Command to Undo the entire Sub macro

Post by Villeroy »

Forget all the macro bullshit and use templates.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Command to Undo the entire Sub macro

Post by JeJe »

Exit sub or Exit Function if its a function as the first line.

If you get the BasicIDETools extension commenting things out with a ' is as easy as selecting the macro.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Command to Undo the entire Sub macro

Post by Villeroy »

Math wrote:I DO NOT want to delete the macros that I will not use, I just want to undo the macro action, because in the future I can use the macro again.
Villeroy wrote:Forget all the macro bullshit and use templates.
You open a new document from a prepared template.
Modify the new document one way or the other.
Save your changes or not. May be you just want to print or export the result and close without saving.
Next new document from the prepared template will be the same as before.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Math
Posts: 89
Joined: Mon Oct 29, 2018 6:32 pm

Re: Command to Undo the entire Sub macro

Post by Math »

Thank you all for the help.

hugs.
LibreOffice 5.4.4.2 on Windows 7
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] Command to Undo the entire Sub macro

Post by Lupp »

-1- There are some actions you cannot undo at all. I can't take the responsibility to list them. Bad or surprising experience to be expected!
-2- What can be undone (if at all) is always the last action performed and not yet undone for a specific component. You cannot "jump into the undo queue", of course.
-3- To undo siomething isn't a task "Basic" can perform. Each component capable of undoing something at all needs to have its own UndoManager.
-4- Elementary undoable actions can be bundled into an UndoContext.
-5- component.UndoManager.enterUndoContext(someStringToBeShownByTheUI.EditMenu) creates such a bundle and opens the sequence of actions to be added to it.
-6- component.UndoManager.leaveUndoContext closes the sequence and manufactures the bundle to make it undoable.
-7- Any error breaking the execution of the script between -5- and -6- will leave the UndoManager in an undefined erroneous state.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply