Description: No value can be assigned to a variable defined as public or private. Steps to Reproduce: 1.Create a form with 2 Buttons 2.Define the following macros OPTION EXPLICIT Public VarI AS Integer Private VarS AS String Sub Button1 MsgBox VarI MsgBox VarS VarI = 1 VarS = "One" End Sub Sub Button2 MsgBox VarI MsgBox VarS VarI = 2 VarS = "Two" End Sub 3. Assign Each macro to the execute action of the appropriate button 4. Run the form and click each button alternately. Actual Results: MsgBox for VarI always displays 0 MsgBox for VarS always displays blank. Expected Results: MsgBox for VarI should alternately display 1 then 2 MsgBox for VarS should alternately display "One" then "Two" Reproducible: Always User Profile Reset: No Additional Info: Version: 6.4.4.2 Build ID: 1:6.4.4~rc2-0ubuntu0.18.04.1 CPU threads: 3; OS: Linux 4.15; UI render: default; VCL: gtk3; Locale: en-GB (en_GB.UTF-8); UI-Language: en-US Calc: threaded This release was supplied by The Document Foundation, Debian and Ubuntu. Copyright © 2000–2020 LibreOffice contributors. LibreOffice was based on OpenOffice.org.
1. What happens if you declare the variables VarI and VarS as "Global" instead of "Public" or "Private" 2. What happens if you add "Option VBASupport 1" to the code and keep the variables "Public" and "Private"? I believe that variables declared with "Public" and "Private" under "Option VBASupport 0"(default) are not PersistentGlobal https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.cxx?r=5f19287a#215 https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.cxx?r=5f19287a#220
(In reply to himajin100000 from comment #1) > 1. What happens if you declare the variables VarI and VarS as "Global" > instead of "Public" or "Private" > 2. What happens if you add "Option VBASupport 1" to the code and keep the > variables "Public" and "Private"? > > I believe that variables declared with "Public" and "Private" under "Option > VBASupport 0"(default) are not PersistentGlobal > > https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim. > cxx?r=5f19287a#215 > > https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim. > cxx?r=5f19287a#220 Putting to NEEDINFO until the reporter comes back with feedback
With variables declared as Global it works fine. VarI displays 1 then 2. VarS displays "one" then "two". With "Option VBASupport 1" declared and the variables "Public" and "Private" 0 and space are displayed as before.
Created attachment 163333 [details] Form with 2 buttons OPTION EXPLICIT Option VBASupport 1 Public VarI AS Integer Private VarS AS String Sub Button1 MsgBox VarI MsgBox VarS VarI = 1 VarS = "One" End Sub Sub Button2 MsgBox VarI MsgBox VarS VarI = 2 VarS = "Two" End Sub
Created attachment 163334 [details] the document that works expectedly
Reproduced. It seems Base Forms works differently than odt. minor note: the document attached by the buttons in the reproters macro uses Application macro, not Document Macro.
typo minor note: the buttons in the document attached by the reproter uses Application macro, not Document Macro.
Dear tj_trevor.jones, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Bug still present in Version: 7.5.0.0.alpha0+ / LibreOffice Community Build ID: 8b82a71013567e148166b514d0ce0f5905f5a3e3 CPU threads: 8; OS: Mac OS X 12.4; UI render: default; VCL: osx Locale: fr-FR (fr_FR.UTF-8); UI: en-US Calc: threaded
(In reply to Alex Thurgood from comment #9) > Bug still present in > > Version: 7.5.0.0.alpha0+ / LibreOffice Community > Build ID: 8b82a71013567e148166b514d0ce0f5905f5a3e3 > CPU threads: 8; OS: Mac OS X 12.4; UI render: default; VCL: osx > Locale: fr-FR (fr_FR.UTF-8); UI: en-US > Calc: threaded If I include Option VBASupport 1 and leave the Private and Public declarations, it behaves in a manner I don't understand. - clicking on Button 1 a first time after opening the form reproduces the bug and displays 0 and an empty MsgBox; - clicking on Button 2 a first time then displays the values "1" and "One" respectively; - subsequently clicking on Button 1 again, i.e. a second time, displays "2" and "Two".