How to apply the same macro code to different ODT files

I have a lot of ODT files and would like to apply the same macro code to them. I don’t want to open the ODT files and paste the macro code manually.

Given the basic macro code is in myBasicMacroCode.txt, what is the command line to tell libreoffice writer to run myBasicMacroCode.txt in ODT file?

I’m running LibreOffice 430m0(Build:2).

Edit 1:

I want a command line or some kind of automate process that I can call because I have thousands of new odt files to process every other weeks.

What I found is you can execute the macro code as follows

libreoffice --headless "macro://./Standard.Module1.YOUR_MACRO" yourfile.odt

But there is catch, YOUR_MACRO needs to exist in yourfile.odt.
If you someone can tell me how to inject automatically the macro code in the odt file, then it will solve my problem.

Create a macro inside My Macros & Dialogs Module1 and paste your code into there. This macro can then be called from any libre office file you own and has a button pointing to it.

In MS-Word, you would create a template that includes the macro code and attach the document to the template. As a LO newbie, I suspected the same would be true for Writer, but I wanted to check first.

It seems my suspicions were correct. Here are a few links that appear to be on point:

Hope these help.

Thx for your effort in answering but these links are not helpful.

Maybe I wasn’t clear. I know how to do it manually by hand(i.e. by clicking) but I have thousands of new odt files every other weeks. I don’t want to do this by hand. I want to a command line instead of clickings so that I can include in a process.

I will update my question.