[Libreoffice-bugs] [Bug 121262] New: User defined function returns argument not result with VBA support enabled

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Nov 8 01:28:55 UTC 2018


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

            Bug ID: 121262
           Summary: User defined function returns argument not result with
                    VBA support enabled
           Product: LibreOffice
           Version: 6.0.6.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: dmgen at posteo.net

Created attachment 146419
  --> https://bugs.documentfoundation.org/attachment.cgi?id=146419&action=edit
Bug demo: spreadsheet to call user defined function ADDUP, function in Module1

User defined functions return one of their calling arguments rather than their
result when VBA support is enabled by declaring;

      Option VBASupport 1

at the start of the module.

I note a warning that imported VBA code may not reliably access LibreOffice
objects at
https://help.libreoffice.org/latest/he/text/sbasic/shared/03103350.html

However, this is native code and it does not access objects.

Here is the spreadsheet (also see attached file:

     VarA     4
     VarB     2
     ADDUP    =ADDUP(B3,B4)

The user defined ADDUP function was created and stored in the spreadsheet’s own
module, as usual i.e. there should be no issue with the spreadsheet not being
able to see the code.

The function adds 2 numbers.

     Function Addup(VarA as Single, VarB as Single) as Single
        Addup = VarA + VarB
     End Function

The result without VBA support is as expected:

     VarA     4
     VarB     2
     ADDUP    6

VBA support is enabled by adding the following at the start of the module:

     Option VBASupport 1

The result with VBA support enabled is that a calling argument is returned, not
the function result:

     VarA     4
     VarB     2
     ADDUP    4

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181108/86d83173/attachment.html>


More information about the Libreoffice-bugs mailing list