How can I import a macro *.bas file into calc?

I’m not a programmer. I’ve used LO for a few years and have macros that make life a lot easier. I record them and then tweak them from various sources on the net.

I installed a new version of calc. From the old version I had exported the macros to a *.bas file, thinking that I would be able to import it. But I don’t see how to do that. I have some very old *.odt files with the text, but they’re dated.

*How can I import that .bas file?

If I can’t import it directly, am I out of luck and have to paste the very old text in, and then update them manually?

Hello,

Installing a new version of LO should have no effect on macros.

If these macros were in MyMacros they reside within the user profile which should not be affected by installing a new version. If the macros were within a document, they are still there. A new version has nothing to do with individual documents.

However, to answer your question of How can I import that *.bas file?:

  • Create a module for the macro to be placed into. From menu Tools->Macros->Organize Macros->Libre Office Basic then on the following dialog select the library (such as Standard) where to create the module. Then click new & give it a name:

If you already have modules defined in a library, you can add more by using the Organizer... button and add new modules on the Module tab.

  • Now once you have Basic IDE open (will open upon module creation), open the module where the code is to be imported to:

image description

  • Then from menu select File->Import Basic and select your .bas file:

Code should then be in selected module.

Thank you very much.

I also found the icon in 5.1 that comes with Ubuntu. I clicked the one I’ve highlighted in yellow, and it let me walk the directories to the *.bas file I wanted.
image description

FTR, I installed a new operating system and was starting from scratch with everything, so I had no macros at all.