Ask Your Question
0

BASIC Calc: How to work with various Libraries ?

asked 2020-01-19 18:34:29 +0100

lonk gravatar image

There are 2 error messages:

image description

image description

C:\fakepath\0003.ods

C:\fakepath\firebird4ask.odb

What was wrong with the code ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-01-19 19:18:08 +0100

Ratslinger gravatar image

updated 2020-01-19 19:27:15 +0100

Hello,

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
    BasicLibraries.loadLibrary("Library2")
Endif

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.

edit flag offensive delete link more
1

answered 2020-01-19 19:13:07 +0100

mauricio gravatar image

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

Sub any_sub()
Globalscope.BasicLibraries.LoadLibrary("Library2")


End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-01-19 18:34:29 +0100

Seen: 32 times

Last updated: Jan 19