Bug 105813 - VBA Macro assignment to control not saved to XLS
Summary: VBA Macro assignment to control not saved to XLS
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 normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyInteresting, easyHack, filter:xls, skillCpp, skillDebug
: 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: 2022-09-25 02:14 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:
Regression By:


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. ***