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

            Bug ID: 151005
           Summary: With VBASupport 1 arguments should be treated as
                    ByValue by default (not as ByRef)
           Product: LibreOffice
           Version: 7.3.5.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

This ticket is a spinoff from bug 150727.

LibreOffice's Basic implementation assumes that arguments are defined as ByRef
(see [1]). So in LO the code below prints "Y" as a result, which is correct.

Sub Test()
    Dim a As String
    a = "X"
    DummySub (a)
    MsgBox (a)
End Sub

Sub DummySub(val As String)
    val = "Y"
End Sub

[1] https://help.libreoffice.org/7.4/en-US/text/sbasic/shared/03090409.html

However, in MS VBA, arguments are passed as ByValue by default, hence the code
above using Option VBASupport 1 should print "X" in LibreOffice, but we still
get "Y" as a result.

If you run the code above in MSO you'll get an "X" as result.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to