[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #11 from tanh --- (In reply to Aron Budea from comment #1) > The direct reason for the self-modifying behavior is that function > "stableford" modifies the "score" parameter, which is apparently passed by > reference. > > I can't tell if it's the correct behavior or not, got confused by different > VB-related MS resources that state contradicting things: > https://msdn.microsoft.com/en-us/library/aa263527(v=vs.60).aspx "Passing by > reference is the default in Visual Basic." > https://msdn.microsoft.com/en-us/library/ddck1z30.aspx "The default in > Visual Basic is to pass arguments by value." > They're for different VB versions, and not VBA, either, but it's still weird. > > Until this is clarified, as a workaround you can copy the parameter to a > local variable, and modify that. Just for note, the 'Visual Basic" referred to in the .NET MS resource "The default in Visual Basic is to pass arguments by value", is VB.Net VB.net is to VBA as c# is to c, only less so. -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Rafael Lima changed: What|Removed |Added See Also||https://bugs.documentfounda ||tion.org/show_bug.cgi?id=15 ||1005 -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #10 from Joshua Coppersmith --- As usual, Eike not only gives an explanation, but also a workaround. And kudo's for the bug...I've never seen anything quite as dynamic as constant number entries changing before my eyes! However, I think I have something to add here. In VBA Variants act a lot like reference names (i.e. wrappers). Even if you pass a Variant using the ByVal keyword that may not give expected results. However, if you pass Integers you will get pass-by-value behavior (I seem to remember, I've moved on to native LO :) ). So instead of Function stableford(score, hcp, ... use Function stableford(score As Integer, hcp As Integer, ... and to be really sure, use Function stableford(ByVal score As Integer, ByVal hcp As Integer, ... I modified the example Excel workbook only by changing the stableford signature to this "really sure" version and then could not reproduce any peculiarities, neither Err:522 nor magic changing numbers. There used to be a trick of putting caller parameters in parentheses when calling from code to code in VB, to force a calculation before the caller parameters were put on the VB stack, sort of defeating ByRef behavior in the called function. (If I remember correctly...) You can't do that directly from a spreadsheet, of course, so you have to armor-plate the function signature itself. -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Andreas Heinisch changed: What|Removed |Added See Also||https://bugs.documentfounda ||tion.org/show_bug.cgi?id=14 ||5279 -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #9 from Eike Rathke --- Normally (...) for user defined functions that are invoked as spreadsheet functions, yes. Now it gets complicated: for whatever reason (I don't know the history behind that specific VBA implementation) if there is Option VBASupport 1 which here is the case then a XCellRange object is passed for cell references. That indeed allows BASIC to modify the cell. It should not and can result in undesired side effects, like here even Err:522 circular references being detected because the cell value modified triggers another recalc that runs into a currently being calculated cell. Changing stableford() to not modify its score argument gets rid of all side effects. -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #8 from Aron Budea --- (In reply to Eike Rathke from comment #7) > Fwiw, arguments passed from Calc to BASIC are passed by value, the > stableford() macro function can not modify cell values that way. Does that mean VBA functions are using a different way of passing arguments in Calc compared to its own BASIC? -- You are receiving this mail because: You are the assignee for the bug.
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 AjexMartin changed: What|Removed |Added URL||https://www.contact-emails. ||com/comcast/ -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #7 from Eike Rathke --- Fwiw, arguments passed from Calc to BASIC are passed by value, the stableford() macro function can not modify cell values that way. -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #6 from sukamin --- I have read your article, it's very informative and helpful for me. I admire the valuable information you provide in your articles. Thank you for posting it. [url=https://shell-shockers.online]shell shockers[/url] -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Aron Budea changed: What|Removed |Added URL|https://accountinghelp247.c | |om/quickbooks-point-of-sale | |/ | -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Melody Anderson changed: What|Removed |Added URL||https://accountinghelp247.c ||om/quickbooks-point-of-sale ||/ -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Xisco Faulí changed: What|Removed |Added URL|https://www.desktop-gold.co | |m/ | -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Addison Gills changed: What|Removed |Added URL||https://www.desktop-gold.co ||m/ -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Xisco Faulíchanged: What|Removed |Added CC||er...@redhat.com --- Comment #5 from Xisco Faulí --- @Eike, any insight here? -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Aron Budeachanged: What|Removed |Added Blocks||108908 Referenced Bugs: https://bugs.documentfoundation.org/show_bug.cgi?id=108908 [Bug 108908] [META] Visual Basic for Applications (VBA) macro issues -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Xisco Faulíchanged: What|Removed |Added CC||xiscofa...@libreoffice.org --- Comment #4 from Xisco Faulí --- Hi Laurie Lang, Should the numbers be added in cell I21:Q23 ? -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Buovjagachanged: What|Removed |Added Keywords||needsConfirmationAdvice CC||todven...@suomi24.fi -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 --- Comment #3 from Aron Budea--- (In reply to Cor Nouws from comment #2) > From what I remember, passing as value is default in VBA. This page also says arguments are passed by reference by default. https://msdn.microsoft.com/en-us/library/office/gg264721.aspx I wonder if this got changed at some point... Though Laurie wrote it was working fine in Excel, which would indicate the arguments are indeed passed by value there. -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Cor Nouwschanged: What|Removed |Added CC||c...@nouenoff.nl --- Comment #2 from Cor Nouws --- (In reply to Aron Budea from comment #1) > I can't tell if it's the correct behavior or not, got confused by different > VB-related MS resources that state contradicting things: > ... ;) > They're for different VB versions, and not VBA, either, but it's still weird. >From what I remember, passing as value is default in VBA. -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
[Libreoffice-bugs] [Bug 101631] VBA function parameter is passed by reference by default
https://bugs.documentfoundation.org/show_bug.cgi?id=101631 Aron Budeachanged: What|Removed |Added CC||ba...@caesar.elte.hu Component|Calc|BASIC Version|unspecified |5.1.4.2 release Summary|Strange auto-modifying |VBA function parameter is |behaviour when EDITING in |passed by reference by |Calc|default Whiteboard||interoperability --- Comment #1 from Aron Budea --- The direct reason for the self-modifying behavior is that function "stableford" modifies the "score" parameter, which is apparently passed by reference. I can't tell if it's the correct behavior or not, got confused by different VB-related MS resources that state contradicting things: https://msdn.microsoft.com/en-us/library/aa263527(v=vs.60).aspx "Passing by reference is the default in Visual Basic." https://msdn.microsoft.com/en-us/library/ddck1z30.aspx "The default in Visual Basic is to pass arguments by value." They're for different VB versions, and not VBA, either, but it's still weird. Until this is clarified, as a workaround you can copy the parameter to a local variable, and modify that. -- You are receiving this mail because: You are the assignee for the bug.___ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs