Page 1 of 1
Edit a macro
Posted: Fri Aug 12, 2022 11:51 pm
by koden
I got a ods file with a macro
it's a calc
I would like to do some change to this macro or just understand it.
Maybe import it to my own calc template
But if I go to options > macros > administrate
I can see the macro.
But edit button is not to use.
How do I see inside this macro and how it works?
I'm new in macros as you probably can see
I have looked in wiki.
Maybe there is a better guide for understanding macros and how to use?
Re: Edit a macro
Posted: Sat Aug 13, 2022 6:18 am
by Zizi64
Maybe there is a better guide for understanding macros and how to use?
Andrew Pitonyak' free macro books:
https://www.pitonyak.org/oo.php/
Wiki:
https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide
The API reference (Application Programming Interface):
http://www.openoffice.org/api/
Xray tool for listing the existing properties and methods of the programming objects:
http://berma.pagesperso-orange.fr/Files ... l60_en.odt
Re: Edit a macro
Posted: Sat Aug 13, 2022 6:42 am
by Zizi64
But if I go to options > macros > administrate
I can see the macro.
But edit button is not to use.
How do I see inside this macro and how it works?
Tools - Macro - Organize Macros - OpenOffice Basic - Browse tha macro tree of the downloaded sample file to the Module1 - Edit
You can create an another Module in an another file by usage of the organizer, and then you can copy-paste the macro code.
Or you can copy the macro code into the MyMacros (into a Module inside the MyMacros): then the macro will available in all of the documents what you open on your PC.
Re: Edit a macro
Posted: Sat Aug 13, 2022 12:11 pm
by koden
ahh.. ok thanks.
When EDIT it opens and shut down again with error...
document recovery error.
Must be something wrong with macro.
But macro works...
Will try download again
Re: Edit a macro
Posted: Sat Aug 13, 2022 3:25 pm
by Zizi64
Try to open the macro editor, when the sample file is NOT open.
Re: Edit a macro
Posted: Mon Aug 15, 2022 1:50 pm
by koden
Thanks working fine now.
every 5 cell it saves and no OK box shows up.
This is in the sample file
next problem...
In my template I have created a module and copied the script from above and saved it.
How do I get the template to use this macro?
because it does not save after 5 cell in my template

Re: Edit a macro
Posted: Mon Aug 15, 2022 2:06 pm
by Zizi64
In my template I have created a module and copied the script from above and saved it.
How do I get the template to use this macro?
because it does not save after 5 cell in my template

You must assign the macro to the event "Changed" of the actual document.
Re: Edit a macro
Posted: Mon Aug 15, 2022 2:35 pm
by koden
hmmm must do something wrong..
assume I go to Tools – Customize in my template document
I get this menu with
menu - keyboard - tools - events
Do I in event, assign the module1 to "save documents" or am I the wrong place?
Just to understand because not needed
have just saved example file as my new template
Re: Edit a macro
Posted: Mon Aug 15, 2022 4:05 pm
by Zizi64
Do I in event, assign the module1 to "save documents" or am I the wrong place?
You have selected a wrong item. The event " 'Modified' status was changed " is located in the same list, but close to the bottom of the list.
Check it in the downloaded sample file Modified Event.ods attached in the another thread:
https://forum.openoffice.org/en/forum/v ... 73#p527273
(this assignment is not displayed - somehow - in the another sample file: AutoSave.ods...)
