https://bugs.documentfoundation.org/show_bug.cgi?id=139457

            Bug ID: 139457
           Summary: Loading libraries with GlobalScope not working as
                    described in LO Help
           Product: LibreOffice
           Version: 7.1.0.1 rc
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 168728
  --> https://bugs.documentfoundation.org/attachment.cgi?id=168728&action=edit
File with the Basic code described in the bug report

Hi! Help pages about Basic libraries state that the library must be loaded by
placing the GlobalScope.BasicLibraries.LoadLibrary("Library Name") statement
before the first macro in the module.

For example, the Help page for the Tools Library says: "This library must be
loaded before execution. Place the following statement before the first macro
in your module:
GlobalScope.BasicLibraries.LoadLibrary("Tools")"

Link:
https://help.libreoffice.org/7.1/en-US/text/sbasic/shared/03/lib_tools.html?DbPAR=BASIC#bm_id491529070339774

The problem is that these instructions don't seem correct. If I create a new
module in the Standard library of a new file and enter the following code (see
that the library is loaded before the first macro):

----------------
GlobalScope.BasicLibraries.LoadLibrary("Tools")

Sub Main
  'Just some random code to showcase the error
  MsgBox "Hello"
End Sub
----------------

Now, if I run the Main macro, I get the error message "BASIC syntax error.
Expected: Sub."

However, if I place the LoadLibrary statement inside the Sub, everything works
fine.

I am reporting this because this issue is either a bug in the Basic interpreter
or it is something that needs fixing in the Help pages.

I attached a ODS file with the example above for testing.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to