Ask Your Question
0

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

asked 2018-09-25 01:52:50 +0200

UserRyan gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-09-25 06:11:12 +0200

Ratslinger gravatar image

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

edit flag offensive delete link more

Comments

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

UserRyan gravatar imageUserRyan ( 2018-09-27 00:41:47 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-25 01:52:50 +0200

Seen: 202 times

Last updated: Sep 25 '18