Bug 105813 - MS->ODF VBA macro assignment to control lost. Same with fixed-VBA-ODF->MS (comment 10)
Summary: MS->ODF VBA macro assignment to control lost. Same with fixed-VBA-ODF->MS (co...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.4.0.3 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xls
: 142073 (view as bug list)
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2017-02-06 23:17 UTC by Jonatham E. Snow
Modified: 2023-05-23 13:06 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Petro-grades-05-05b.ods spreadsheet containing VBA macros linked to controls. (171.39 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-02-06 23:17 UTC, Jonatham E. Snow
Details
Petro-grades-05-05c.ods (saved from LO) Macro buttons work (171.35 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-02-06 23:19 UTC, Jonatham E. Snow
Details
Petro-grades-05-05c.xls (saved from LO) Macro buttons don't work, macros do. (282.00 KB, application/vnd.ms-excel)
2017-02-06 23:20 UTC, Jonatham E. Snow
Details
The same case in a docm file (17.15 KB, application/vnd.ms-word.document.macroEnabled.12)
2018-07-17 12:18 UTC, Balázs Varga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonatham E. Snow 2017-02-06 23:17:29 UTC
Created attachment 130967 [details]
Petro-grades-05-05b.ods  spreadsheet containing VBA macros linked to controls.

BRAVO for improving VBA support in LO! But:

Procedure to reproduce bug:

1) Open spreadsheet containing VBA code linked to controls. 
2) Macro code works 
3) Save to .ods
4) Macro code still works properly
5) Save to .xls
6) Macro assignment to controls is not saved. 

Controls still work, macros still work, macros can be re-assigned to 
their buttons, but cannot be saved to .xls. 

This is critical functionality, as many of my colleagues do not have 
LO and need the xls format. 

enclosed are three filed: 
Petro-grades-05-05b.ods  spreadsheet containing VBA macros linked to controls.   
Petro-grades-05-05c.ods  (saved from LO) Macro buttons work
Petro-grades-05-05c.xls  (saved from LO) Macro buttons don't work, macros do. 

Recommendation: Save macro assignments to controls in xls export.
Comment 1 Jonatham E. Snow 2017-02-06 23:19:13 UTC
Created attachment 130968 [details]
Petro-grades-05-05c.ods  (saved from LO) Macro buttons work
Comment 2 Jonatham E. Snow 2017-02-06 23:20:07 UTC
Created attachment 130969 [details]
Petro-grades-05-05c.xls  (saved from LO) Macro buttons don't work, macros do.
Comment 3 Jonatham E. Snow 2017-02-06 23:20:55 UTC
Note: Student data has been faked!
Comment 4 Buovjaga 2017-02-12 14:56:46 UTC
Reproduced.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha0+
Build ID: ac8197327d3ef4f3c94fb0746393863404df086b
CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on February 11th 2016
Comment 5 Markus Mohrhard 2017-05-11 18:05:25 UTC
So I think this can be made an Easy Hack and I'm willing to mentor the task.

The first step will be to analyze the existing xls files with oletoy (https://github.com/renyxa/re-lab/tree/master/oletoy).

Document your findings in this bug report explaining how macros are connected to to elements.

The code for the xls export that will need to be adapted is in sc/source/filter/excel. Most likely we should adapt the XLSX export at the same time which shares significant parts of the export code.
Comment 6 Jonatham E. Snow 2017-09-29 16:46:14 UTC Comment hidden (no-value)
Comment 7 Jonatham E. Snow 2017-10-12 23:53:05 UTC Comment hidden (no-value)
Comment 8 Balázs Varga 2018-07-17 12:18:47 UTC
Created attachment 143592 [details]
The same case in a docm file

The same case in a docm file (created with MS-WORD 2016), if we import or export with LibreOffice Writer.
Comment 9 Justin L 2022-09-25 02:14:35 UTC
*** Bug 142073 has been marked as a duplicate of this bug. ***
Comment 10 Justin L 2022-10-10 11:57:54 UTC
Going from ODS to XLS should not really be expected to work. For that, we have bug 139938.

Making the case that we should be able to go from XLS to ODS (and back again - or to XLSM) might be more reasonable. Probably this bug report should focus on that aspect. Repro 7.5+ with DOCM using comment 8's attachment 143592 [details]. (Also repro with "Disable VBA refactoring" extension.)
Comment 11 Justin L 2023-05-23 13:02:40 UTC
Wow - macros don't even exist when saved in XLS format, and this is flagged as an easyHack? After 6 years I would fear to have to tackle this... Sounds more like a google summer of code project than an easy-hack.