Created attachment 142919 [details] Example file from Excel If we try to run the macro in the attached file, the file listing For Each loop will not run. Steps to reproduce: 1. Create a new spreadsheet with Microsoft Excel 2016/2013 2. Open the Visual Basic window 3. Add a new Module to your VBAProject 4. Use this simple code: Sub fileoperation() Dim fso As Object Dim dir As Object Dim Files As Object Dim File As Object Dim i As Integer Set fso = CreateObject("Scripting.FileSystemObject") If Range("D2") = "" Then x = Range("B3").CurrentRegion.Rows.Count + 1 sx = Cells(x, 2).Address(False, False) Range("A3:" + sx + "").ClearContents MsgBox "Empty data" Else s = Range("B3").CurrentRegion.Rows.Count + 1 st = Cells(s, 2).Address(False, False) Range("A3:" + st + "").ClearContents a = Range("D2") If fso.FolderExists(a) = False Then MsgBox "Folder doesn't exists" Else Set dir = fso.GetFolder(a) Set Files = dir.Files i = 2 For Each File In Files //This loop does not work in LibreOffice. Cells(i + 1, 1).Value = File.Name Cells(i + 1, 2).Value = File.Path i = i + 1 Next File MsgBox "Found " & Files.Count & " files." End If End If End Sub 5. Write a Directory path (which contains files) to the “D2” cell. Run the macro. 6. Save the file as *.xlsm 7. Open the file with LibreOffice Calc. Run the macro. Actual results: The macro is executed but the “For Each File In Files” was ignored. So the files name and paths were not listed. Expected results: This simple basic code run perfectly in Microsoft Excel, even if I reopen the file with Microsoft Excel, after I saved in LibreOffice Calc. This simple macro should run perfectly in LibreOffice Calc. Version: 6.2.0.0.alpha0+ Build ID: c3e552ac25be001a623469c549ee8d0719b98133 CPU threads: 1; OS: Windows 6.1; UI render: default; TinderBox: Win-x86@42, Branch:master, Time: 2018-06-13_23:01:19 Locale: hu-HU (hu_HU); Calc: group threaded
Created attachment 142922 [details] Screenshot of the macro output in Calc and Excel side by side
It works for me. Please try a more recent version. Also: as you are making these big report batches, please always at least do regression testing and preferably do bibisecting, if you run into a regression. Also fill out the keywords and put meta report(s) to Blocks field. Version: 6.2.0.0.alpha0+ (x64) Build ID: 2c85607101e2e04e870e3b87362f39f9a9148e6c CPU threads: 4; OS: Windows 10.0; UI render: default; TinderBox: Win-x86_64@42, Branch:master, Time: 2018-06-16_00:12:37 Locale: fi-FI (fi_FI); Calc: group threaded
Created attachment 143078 [details] reproducible document with simpler code DON' FORGET TO PUT SOME FILES in C:\lolog I had 12 files there Expected Result(in Excel VBA): True Actual Result(in LibreOffice StarBasic): False Minor note: It seems StarBasic Adds "Option VBASupport 1", when it opens .xlsm . This option is required to get Actual Result. if you don't have this line, you will encounter a "type mismatch error". Even in this case you will not get the Expected Result.
NEW per comment 3
"...more useful stuff" section may be useful. http://www.papwalker.com/ref101/ccol.html
MSDN document pointer https://msdn.microsoft.com/en-us/library/windows/desktop/ms221354(v=vs.85).aspx
Dear Gabor Kelemen, 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 http://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://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Dear Gabor Kelemen, 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
(In reply to Gabor Kelemen (allotropia) from comment #0) > Actual results: The macro is executed but the “For Each File In Files” was > ignored. Regardless of implementing the requested functionality, there is a problem here IIUC that needs addressing: if it doesn't find an iterable object in the loop initialization, there should be an error, not a silent continuation (I haven't checked myself, just a thought I had reading the issue).
Dear Gabor Kelemen (allotropia), 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