Moving a macro

Creating a macro - Writing a Script - Using the API

Moving a macro

Postby RusselB » Thu Jun 11, 2020 9:48 pm

I have a macro that was created a while back by Lupp.
The macro is embedded into the spreadsheet he provided.
I would like to use the macro with other spreadsheets, but don't know how to go about making the changes.
Looking forward to getting the steps to complete this.
Thanks in advance.
OpenOffice 4.1.7 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 6062
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Moving a macro

Postby Zizi64 » Thu Jun 11, 2020 9:58 pm

Copy the macro code into a Module of the Standard library of the MyMacros. Then it will be available from every ODF document on that PC.

Or just create a copy of the document, delete the content, and save it as a template. When you open it in the future, the macro will work in all the new Unnamed documents created based on that template.
Tibor Kovacs, Hungary; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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: 9431
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Moving a macro

Postby John_Ha » Fri Jun 12, 2020 12:21 am

Tools > Macros > Organise macros > OOBasic ..., shows as below where the open document Untitled 1 has no macros.

Highlight the macro in your document as below and click Edit. Copy everything (it will start sub xxx ... and end with end sub).

Edit Module 1 Main and and paste it anywhere (ie the order is unimportant ... but don't paste it in the middle of an existing macro :super: )
Attachments
Clipboard01.png
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 7774
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Moving a macro

Postby RusselB » Fri Jun 12, 2020 3:07 am

Thanks for the responses.
OpenOffice 4.1.7 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 6062
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Moving a macro

Postby Villeroy » Fri Jun 12, 2020 7:16 am

If the library has a name other than "Standard", you can call the macro organizer, tab "Libraries", and export the docuemnt library either as an extension or as a library folder. Both can be imported to "My Macros".
Any library under "My Macros" AND "LibreOffice Macros" is constantly availlable and loaded automatically when called through a script event.
The ones under "LibreOffice Macros" are availlable to all system users and need to be installed via a program named "unopkg".
Libraries in "My Macros" are availlable to the currently logged in system user and are freely editable and manageable because they are stored in the user profile.
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.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests