Edit a macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
koden
Posts: 40
Joined: Mon Jul 04, 2022 2:13 pm

Edit a macro

Post 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?
open office 4.1.11
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Edit a macro

Post 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
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Edit a macro

Post 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.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
koden
Posts: 40
Joined: Mon Jul 04, 2022 2:13 pm

Re: Edit a macro

Post 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
open office 4.1.11
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Edit a macro

Post by Zizi64 »

Try to open the macro editor, when the sample file is NOT open.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
koden
Posts: 40
Joined: Mon Jul 04, 2022 2:13 pm

Re: Edit a macro

Post 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 :-)
open office 4.1.11
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Edit a macro

Post 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.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
koden
Posts: 40
Joined: Mon Jul 04, 2022 2:13 pm

Re: Edit a macro

Post 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
open office 4.1.11
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Edit a macro

Post 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...) :?: :?:
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply