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.
In MS VBA, arguments are passed BYREF as default. (Documentation claims that VB.NET is different). In MS VBA the test case shown creates a temporary reference by using an expression DummySub (a) The expression (a) is created, referenced, updated to 'Y', and discarded. Subsequent use of the variable a is not affected by the discarded (expression) To demonstrate the same behavior using Call syntax: Call DummySub( (a) ) Wrapping a variable in () creates an expression. The CALL syntax requires call brackets, which are not expression brackets.
In LO, the statement DummySub (a) Does NOT create and discard a reference. Rather, it acts the same way as the CALL syntax LibreOffice: DummySub(a) is the same as Call DummySub(a). MS VBA: DummySub (a) is NOT the same as Call DummySub(a) LibreOffice: DummySub2(a,b) is NOT a syntax error. MS VBA: DummySub2(a,b) IS a syntax error. MS VBA: Call DummySub2(a,b) is NOT a syntax error. LibreOffice: Call DummySub2( (a), b) is the same as Call DummySub2( a,b) MS VBA: Call DummySub2( (a), b) is NOT the same as Call DummySub2( a,b) ========== sub Test() Dim a As String,b a = "X" call DummySub2((a),b) MsgBox (a) End Sub Sub DummySub2(val As String,b) val = "Y" End Sub ==========