BASIC Calc: How to work with various Libraries?

There are 2 error messages:

image description



What was wrong with the code ?

Only library Standard is load by default, others libraries you need load in memory before used:

Sub any_sub()

End Sub


These errors are related. The first is because ConnectDatabase is not accessible & the second because in the error routine DisconnectDatabase is also not accessible. You already have the answer (see → Calc BASIC | How to call Function in other Library ?. You just need to add:

If Not BasicLibraries.isLibraryLoaded("Library2") then

before line #7 - the call to ConnectDatabase

Keep this in mind when initially calling TestConnectDatabase1. Library1 needs to be loaded. Probably do both when opening the Calc file. Just put a sub in the Standard library to load both and attach to Open Document event.