https://bugs.documentfoundation.org/show_bug.cgi?id=172748

            Bug ID: 172748
           Summary: Filesave XLSM: Basic macros created in LibreOffice are
                    silently lost on save (data loss, no warning)
           Product: LibreOffice
           Version: 27.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
LibreOffice Calc silently discards Basic (StarBasic) macros when a document
created in LibreOffice is saved to the macro-enabled XLSM format. No warning is
shown, and after reopening the saved .xlsm in LibreOffice the macros are gone -
this is data loss of the user's own work, inside LibreOffice itself. 

The behaviour is inconsistent: if you open an existing .xlsm (created outside
LibreOffice) that already contains a macro project, edit the macro code and
save, the changes ARE preserved. Only macros authored from scratch in
LibreOffice are dropped.

Steps to Reproduce:
1. Open a new spreadsheet in LibreOffice Calc.
2. Tools - Macros - Edit Macros; in the Standard library add a module with a
macro, e.g.:
   Sub FillSum
       ThisComponent.Sheets.getByIndex(0).getCellByPosition(0, 0).setValue(6)
   End Sub
3. Save as "Excel 2007-365 (macro-enabled)" (.xlsm). No warning appears.
4. Close and reopen the saved .xlsm in LibreOffice.
5. Open the Basic IDE and look at the Standard library.

Actual Results:
The module and macro are gone; the reloaded .xlsm contains no Basic code.
Nothing was written to xl/vbaProject.bin on save, and no warning was shown.

Expected Results:
Macros are preserved during the save-reopen cycle in LibreOffice.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
The XLSM exporter writes xl/vbaProject.bin only when the document already
carries import-time VBA metadata, so a macro project created from scratch in
LibreOffice is never written out and is lost on save.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to