Your achievements with Visual BASIC coding in LO

Hey everyone.
I wanted to know what you all achieved using the BASIC language in LibreOffice.
Did you automate your job? Speed up something that you do in your spare time?

I have heard a lot from people who have automated stuff with VBA in MS, but I wanted to know what you achieved using BASIC in LibreOffice (especially in Calc).

I beg your pardon, but how and in what way will the answer to this question help you? Even if you get some very detailed answers - what you will take away from them? “Do you often look at the stars? What air do you prefer to breathe? Are you reading this text just like me now?” There are many questions, the answers to which are either obvious or not interesting to anyone. So I ask - why did you write this question?

I should have given the reasons why.

I have heard (=read actually) a lot of posts and comments from people who sped up their jobs by automating Excel, and I wanted to know if LO users have achieved similar outcomes, such as making a 60-hour job a 5-hour job (I will still use LO even if BASIC might not be able to execute similar codes).

I am asking because finding reasons to learn something makes the learning process easier, and knowing that some LO users have automated, for example, very repetitive tasks or made their life easier, is a booster for me.
If I find enough reasons to learn something (like I didSQL for example), it makes the learning process easier.

(The comment above was posted while I wrote my answer.)
Generally: There are some jobs you can speed-up “12 times”.
I would doubt then:
-1- Was it a resonable and useful task anyway?
-2- Were the means allowing for such an enhancement by user code in Basic chosen well from the beginning?
-3- May be many more…

Example ad -1-: Transforming a list of names and e-mail addresses contained in a spreadsheet to actual emails sent out, should be suspected spam, not job.
Example ad -2-: A spreadsheet was misused for a real database task. Using the proper means would probably solve the problem you think to need programming for by simply avoiding it or by built-in means.

@LibreOfficeDude Thanks I got it. In this case, I can give a specific example - I know one online store with a very large number of various products from several dozen different suppliers. Each supplier provides information almost daily in its own format - some in CSV, some in Excel spreadsheet, and there are other formats. Information from all these sources is loaded onto the site from a text table in a fixed format. Macros load the source file into Calc, clean up the data from garbage (for example, out of stock records or duplicate values), and unload the data in the specified format. A debugged macro will process each source file for no longer than three minutes. LibreOffice does all this work in automatic mode, human (programmer) intervention is required only if one of the suppliers decided to change the form of their file ( @Lupp, I remember you recently wrote about something similar in one of the comments, I did not could find that text)


i’v mostly tried (and sometimes failed) to solve problems for other people. Here are some of the more successful tries:

Most are on the smallish side.
If you are looking for more advanced macro magic,
maybe somebody who has more experience can share a story and some code.

Hope it still helps.

I will take a look at the links you posted.
Even if they might be on the smallish side, it’s helpful to to see some examples anyway.
Thanks for the reply.

(Reading the question like "Would it pay to learn…?)

The subject is talking of “Visual BASIC” while the body of the question is talking of the “BASIC language in LibreOffice”.

That’s very different.

As far as I understand, programming for document automation in MS Office requires the appropriate VB​A variant which is a kind of API for the respective application like Word or Excel in addition to its features as a programming language of the Basic family.

You can’t do much of real use with LibreOffice using Basic allone. You need to use the (uno-) API of LibreOffice in most cases, which is rather powerful, but far from being perfect. At least it’s all but simple, or easy to learn. The documentation is a matter of its own, and there seems not to be a single tutorial teaching it straight forward. The best source for beginners I know of comes as two texts (the “book” and the “useful information”) by Andrew Pitonyak both featuring the “OOo Basic”, but explaining mainly the API usage beyond the few things being specific to Basic.

Basic as a tool coming with LibO is rather poor concerning its language elements and its toolbox of predefined functions and routines. It has a useful, but limited IDE. However, it has a short and wide bridge to the API, and can therefore be used as a kind of reference language for some ifs and hows in programming for LibO.

There are also bridges from/to different languages like (Java, Python e.g.) about I don’t know much.

Personally I prefer to design the text templates and spreadsheets I actually use without relying on user programming. The many cases where I also wrote special code mainly aimed on understanding, learnig to know what works and what doesn’t, trying to help users asking for solution to very special tasks. In short: Much of this part was playful or doubtable anyway in a sense.

Very few pieces of my own code I use to tweak the UI the way I like it.

Was this useful? Iwould doubt.

I am not a big expert in programming, but the macros I have written for my spreadsheets greatly reduce my time for maintaining large and complex documentation and remove errors that are inevitable during manual work. Basic in LO Calc is a very useful tool. I don’t know how useful my answer is to you.

Your answer is useful: it shows that people who have used programming in LO can reduce manual work greatly.
I’m learning quite a bit of it right now as beginner, and it will definitely come in handy!
Thanks for the reply.