[Solved] Tutorial/instructions on Basic macro usage

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
wizard_chef
Posts: 7
Joined: Sun Apr 13, 2014 7:05 pm

[Solved] Tutorial/instructions on Basic macro usage

Post by wizard_chef »

I am an old hand with Excel and VBA but fairly new to OpenOffice. I would like to begin to design and incorporate Basic macros into my OO spreadsheets. Is there a book, Web site, YouTube tutorial, or other instructions out there on using and debugging macros in OO?
Last edited by wizard_chef on Sun Mar 01, 2020 6:19 am, edited 1 time in total.
Ernie
NacIS 10.9.2
OpenOffice 4.0.1
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Tutorial/instructions on Basic macro usage

Post by RoryOF »

You may find, in conjunction with any pre-written macros you find, that the OpenOffice BASIC manual at

https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide

Will give you sufficient to adjust any such macros to your desired ends, but you will have to do some work.

A good place to learn about OpenOffice macros in great detail is http://www.pitonyak.org/oo.php
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: Tutorial/instructions on Basic macro usage

Post by JeJe »

The programming guide is also available as a pdf

https://wiki.openoffice.org/w/images/c/ ... o3.2.0.pdf

Get MRI

https://extensions.openoffice.org/en/node/201/releases

and Basic IDE Tools

https://extensions.openoffice.org/en/pr ... -ide-tools

Use searches here - someone will almost always have asked a question about what you want to do before.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Tutorial/instructions on Basic macro usage

Post by Zizi64 »

Basic macros into my OO spreadsheets. Is there a book, Web site, YouTube tutorial, or other instructions out there on using and debugging macros in OO?
The knowledge of the built-in StarBasic language and the IDE will not enough for you. It is enough for the simpliest macros only.
You must study athe API functions (those are programming language independent functions) that you need call from your macros to control the feature of the office suite. API: Application Programming Interface.
In my opinion there is no way to know ALL OF the existing API functions, procedures and interfaces of the AOO/LO... There are excellent extensions to list the existing properties, methods of the programming objects: The MRI and the XrayTool.
Last edited by Zizi64 on Mon Mar 02, 2020 1:26 pm, edited 1 time in total.
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.
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

Re: Tutorial/instructions on Basic macro usage [Solved]

Post by oonk »

wizard_chef wrote:I am an old hand with Excel and VBA but fairly new to OpenOffice. I would like to begin to design and incorporate Basic macros into my OO spreadsheets. Is there a book, Web site, YouTube tutorial, or other instructions out there on using and debugging macros in OO?
1. Forget about MS Office & VBA.
2. Read this book, https://g.co/kgs/DRDSPQ, starting from the first page.
3. Create 'only' an .ods file using all examples from such book.
4. After finishing, read all other sources as recommended as above additionally.

I have been migrating from MS Windows and MS Office for over one year. Now my new office, we use only Fedora Workstation, Fedora Server and LibreOffice only. Now I nearly finish writing LibreOffice Calc BASIC codes to replace VBA.
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
wizard_chef
Posts: 7
Joined: Sun Apr 13, 2014 7:05 pm

Re: Tutorial/instructions on Basic macro usage [Solved]

Post by wizard_chef »

This raises a whole new question ... OpenOffice vs LibreOffice ... which is probably discussed elsewhere on the forum. (Book already on order).
Ernie
NacIS 10.9.2
OpenOffice 4.0.1
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

Re: Tutorial/instructions on Basic macro usage [Solved]

Post by oonk »

wizard_chef wrote:This raises a whole new question ... OpenOffice vs LibreOffice ... which is probably discussed elsewhere on the forum. (Book already on order).
All those OO Calc BASIC examples work well in LibreOffice :) .
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Tutorial/instructions on Basic macro usage [Solved]

Post by Villeroy »

The problem is NOT the Basic language (you could also use Python as macro language or VB via .NET). The true problem is the API which is by a magnitude more complicated than the MS Office API. This API is based on "Unified Network Objects" (UNO) which is a very thin layer on top of the core application whereas the MS Office API is more like a second user interface for coders.
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
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] Tutorial/instructions on Basic macro usage

Post by Lupp »

The main problem with the uno-API (universal network objects - a big word, truely) is that there is NOT a usable index based on more general terms for describing something you want to achieve and pointing to the services actually (or probably) appropriate for the task. In fact you need to get an idea on your own, or to know an example a wise user gave or to spend hours of studies in the API refrence and test if you understood it as meant. Have a walk through the API reference to see what I mean. You may start at https://api.libreoffice.org/docs/idl/re ... paces.html and enter something in the 'Search' input line.
Concerning the programming language to use there are many disadvantages, but also some advantages of Basic over different ones, imo. Since the advantages are often unmentioned in this forum, I would name a few of them:
-1- LibreOffice (and AOO) Basic come with an IDE/debugger supporting to some degree the experimental style of programming many users like.
-2- If there is a bug it's one you know to whom to address the report. No general hints about version conflicts and the like.
-3- The bridge to the API is rather handy, and there are a few useful predefined names helping with this respect.
-4- At least LibO Basic's support for VBA was improved, and is sometimes useful even as an extension when writing programs from scratch, and not only in attempts to move something from MS to FOSS (Excel to Calc mainly).
Emphasizing the disadvantages may be left to others.
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