Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to import Basic macro (*.bas) from another macro subroutine?

I know Basic macros can be imported from the Basic IDE by File -> Import Basic

But is there a way to import/load a .bas file and it's subroutines/functions from a macro? For example, I am trying to open a file, /some/path/foo.fods that will load/call another macro at /some/other/path/bar.bas

rem -- /some/path/foo.fods 
sub initFile()
    ThisComponent.LoadMacrosFromURL("file://some/other/path/bar.bas")
    bar.foo() 
end sub

rem -- /some/other/path/bar.bas
sub foo()
   ...
end sub

My goal is basically to separate my existing macro from the Calc file but retain the same functionality.

I have found it difficult to version control the macro so I am hoping to split it from the .fods file to make it easier.

Thank you!