[Solved] Command to Undo the entire Sub macro

Creating a macro - Writing a Script - Using the API

[Solved] Command to Undo the entire Sub macro

Postby Math » Tue Nov 13, 2018 11:04 pm

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
Math
 
Posts: 89
Joined: Mon Oct 29, 2018 6:32 pm

Re: Command to Undo the entire Sub macro

Postby Villeroy » Tue Nov 13, 2018 11:28 pm

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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27610
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Command to Undo the entire Sub macro

Postby JeJe » Tue Nov 13, 2018 11:47 pm

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.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 706
Joined: Wed Mar 09, 2016 2:40 pm

Re: Command to Undo the entire Sub macro

Postby Villeroy » Wed Nov 14, 2018 12:25 pm

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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27610
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Command to Undo the entire Sub macro

Postby Math » Wed Nov 14, 2018 1:37 pm

Thank you all for the help.

hugs.
LibreOffice 5.4.4.2 on Windows 7
Math
 
Posts: 89
Joined: Mon Oct 29, 2018 6:32 pm

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

Postby Lupp » Mon Dec 03, 2018 2:24 pm

-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 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2622
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 4 guests