# 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()
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!

edit retag close merge delete

Sort by » oldest newest most voted

Hello,

My preference would be to use Python.

Have not tried, but it appears you can load Basic libraries. See the following:

Accessing Libraries from Basic

OObasic Macros to Import and Export Libraries

Andrew Macro - PDF. See section 5.29. Macro libraries

HTH

more

Thanks for the links! Been thinking about converting to python for a while. Guess maybe the time is finally here. Will update the this thread if I ever figure it out with .bas

EDIT: unfortunately never found a solution for the original question, however, I highly recommend the switch to python. Simplifies many logic aspects and much easier to read

( 2018-09-27 00:41:47 +0200 )edit