LibreOffice Calc 5.2.4.2.0 20m0(Build:2) on Arch Linux 64-bit. It is impossible to add and save a new VBA module in an existing XLS or XLSX file (created in Excel, macros inside VBAProject). Also, when a new worksheet is created in Libreoffice, it is impossible to save a VBA macro attached in this new worksheet. Additionally, when trying to save an XLS (old format) file, an "Input-output error" message box appears and libreoffice hangs (cannot exit, have to kill soffice.bin). Steps to reproduce: 1. Open an XLS file (created in Excel, with VBAProject inside) and open LibreOffice Calc's Basic editor. 2. Click on "Select Module". Add a new module in the VBAProject->Modules. 3. Add a few lines of code to the new module. 4. Try to save the file.
Hi pgkos, VBA and Basic Language used into LibreOficce differ. See here how to import, use or transform those codes: https://help.libreoffice.org/Common/Using_Microsoft_Office_and_LibreOffice Thank you, Jacques
(In reply to Jacques Guilleron from comment #1) > Hi pgkos, > > VBA and Basic Language used into LibreOficce differ. > See here how to import, use or transform those codes: > https://help.libreoffice.org/Common/Using_Microsoft_Office_and_LibreOffice > LibreOffice supports VBA and since 5.1 even supports saving back changed VBA streams.
(In reply to pgkos from comment #0) > 1. Open an XLS file (created in Excel, with VBAProject inside) and open > LibreOffice Calc's Basic editor. Please attach such an example file. Set to NEEDINFO. Change back to UNCONFIRMED after you have provided the document.
Created attachment 130149 [details] An empty XLS file created in Excel 2003 with embedded VBAProject I am attaching a simple XLS file created in Excel 2003 which contains an embedded VBAProject.
Created attachment 130154 [details] gdb backtrace The bug occurs also on the newest LibreOfficeDev 5.4.0.0.alpha0. I am attaching a gdb backtrace.
More detailed steps: 1. Open example file, go to Tools - Macros - Organize dialogs 2. Go to tab Modules, expand excel_2003_vba > VBAProject > Modules 3. Click New, OK to create new Module1 under Modules 4. Click Edit, add some Rem comments or whatever 5. Try to save as XLS General Error. General input/output error. LibO UI turns grey, top menus works, but items are disabled.. have to kill process. Arch Linux 64-bit, KDE Plasma 5 Version: 5.4.0.0.alpha0+ Build ID: 1a58cdf8af1aba52ce0a376666dd7d742234d7cf CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; Locale: fi-FI (fi_FI.UTF-8); Calc: group Built on January 4th 2016
This is a problem coming from the VBA export work. In the old code we could not export the changed VBA stream so it was not a problem that we never correctly added new modules to the VBA part of the basic library. I think I have a simple fix for that.
Markus Mohrhard committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=2be139d76bdb66e77719613d802dc0047c284456 tdf#105069, store the VBA module info for new modules as well It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Hello Markus, Thank you for the patch. It fixes the issue with modules inside XLS files. It is now possible to add and save new modules. There is one small bug left. When I add a new worksheet to an XLS file and then add a macro to this worksheet, and save the file, the worksheet macro module is not recognized properly by Excel. (it shows up as a duplicate sheet module with a wrong icon - the same as of ThisWorkbook module) I suppose that this is caused by not including a CodeName record in the new worksheet substream (signature 0x01ba, EXC_ID_CODENAME).
(In reply to pgkos from comment #9) > Hello Markus, > > Thank you for the patch. It fixes the issue with modules inside XLS files. > It is now possible to add and save new modules. > > There is one small bug left. When I add a new worksheet to an XLS file and > then add a macro to this worksheet, and save the file, the worksheet macro > module is not recognized properly by Excel. (it shows up as a duplicate > sheet module with a wrong icon - the same as of ThisWorkbook module) > > I suppose that this is caused by not including a CodeName record in the new > worksheet substream (signature 0x01ba, EXC_ID_CODENAME). That is expected as worksheets are much more complicated to handle that normal modules. I have not yet an idea how to recognize them in the basic code.
(In reply to pgkos from comment #9) > Hello Markus, > > Thank you for the patch. It fixes the issue with modules inside XLS files. > It is now possible to add and save new modules. > > There is one small bug left. When I add a new worksheet to an XLS file and > then add a macro to this worksheet, and save the file, the worksheet macro > module is not recognized properly by Excel. (it shows up as a duplicate > sheet module with a wrong icon - the same as of ThisWorkbook module) > > I suppose that this is caused by not including a CodeName record in the new > worksheet substream (signature 0x01ba, EXC_ID_CODENAME). Can we maybe create a new bug report for this problem. Having independent bug reports (they can still be linked with the "See Also" feature) helps in tracking which bugs I still need to handle.
Markus Mohrhard committed a patch related to this issue. It has been pushed to "libreoffice-5-3": http://cgit.freedesktop.org/libreoffice/core/commit/?id=fd242f02b195f896b23336fe51773d7abf310d4e&h=libreoffice-5-3 tdf#105069, store the VBA module info for new modules as well It will be available in 5.3.3. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.