I'd like to call sub and function from libre office basic from document text, such as
[call sub initNumbering()]
text - blah
Some caption defined as "Card Nr."+[call function getCardNr()]
text - blah
[call sub nextCard()]
But I didn't find a way to accomplish calling those functions in such a way.
I tried in libre writer to use menu "Insert-Field-more fields", and there tab "functions" - it lists "execute macro", and I even can navigate to the self written macro, but after "insert" it only shows a thin grey placeholder instead of the contents the macro function should generate to be displayed as part of the text.
Maybe some small "hello world" example - first the macro definition:
REM ***** BASIC *****
Function getName() as String
getName = "Hello world!"
End Function
then the ODT using it, after inserting the function by menu "Insert-Field-more fields", tab "functions", "execute macro":
Generated text: „vnd.sun.star.script:Standard.Test.getName?language=Basic&location=document“
I'd expect to have "Hello world" inserted between the quotes, but it shows only the link of the inserted execute-macro-field, not its result.