Bug 118224 - FILEOPEN XLSX Basic code to Enable Control does not work with Application.OnKey "^x" and Application.CellDragAndDrop
Summary: FILEOPEN XLSX Basic code to Enable Control does not work with Application.OnK...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xlsx
: 168186 (view as bug list)
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2018-06-18 12:21 UTC by Gabor Kelemen (Collabora)
Modified: 2026-01-28 16:34 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Excel (20.75 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2018-06-18 12:21 UTC, Gabor Kelemen (Collabora)
Details
Example file saved by Calc 6.0 (16.12 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2018-06-18 12:28 UTC, Gabor Kelemen (Collabora)
Details
Error message upon file opening (196.74 KB, image/png)
2018-06-18 12:29 UTC, Gabor Kelemen (Collabora)
Details
Error message upon file closing (137.66 KB, image/png)
2018-06-18 12:29 UTC, Gabor Kelemen (Collabora)
Details
Screenshot of the problem (39.04 KB, image/png)
2018-06-18 12:38 UTC, Gabor Kelemen (Collabora)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (Collabora) 2018-06-18 12:21:51 UTC
Created attachment 142856 [details]
Example file from Excel

If we open the attached file (which contains a macro) with LibreOffice Calc we get an Error message: “BASIC runtime error. ‘51’ Internal Error”. The Enable Controls (Application.OnKey "^x" and the others) function does not work. When we close the file we get another Error message: “BASIC runtime error. ‘423’ CellDragAndDrop”.

Steps to reproduce:
1. Create a new spreadsheet with Microsoft Excel 2016/2013
2. Add a value to a cell.
3. Open the Visual Basic window
4. Create a new module and copy the basic code which is in the attached file.
5. Try to copy a cell or drag a cell and drop. (It will work well)
6. Save the file as *.XLSM
7. Open in LibreOffice Calc. (You will got an error message). Here is a code snippet:
Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
On Error Resume Next
For Each CB In Application.CommandBars
    Set C = CB.FindControl(Id:=Id, recursive:=True)
    If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

8. Try to copy a cell or drag a cell and drop. (It will work wrong)
9. Save as the file and open with Microsoft Excel.
10. Try to copy a cell or drag a cell and drop. (It will work well)

Actual results: We got two different error message (we should not) and the enable control function does not work well.

Expected results:
We should not get any error message and these simple enable controls should work well. 

Version: 5.4.3.2
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: hu-HU (hu_HU); Calc: group

Version: 6.0.0.1.0+
Build ID: c678dc5309741097d9b0265f03dd279a8794d256
CPU threads: 4; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:libreoffice-6-0, Time: 2017-12-28_04:21:33
Locale: hu-HU (hu_HU); Calc: group
Comment 1 Gabor Kelemen (Collabora) 2018-06-18 12:28:38 UTC
Created attachment 142857 [details]
Example file saved by Calc 6.0
Comment 2 Gabor Kelemen (Collabora) 2018-06-18 12:29:09 UTC
Created attachment 142858 [details]
Error message upon file opening
Comment 3 Gabor Kelemen (Collabora) 2018-06-18 12:29:36 UTC
Created attachment 142859 [details]
Error message upon file closing
Comment 4 Gabor Kelemen (Collabora) 2018-06-18 12:38:13 UTC
Created attachment 142860 [details]
Screenshot of the problem
Comment 5 Buovjaga 2018-06-24 17:56:34 UTC
Confirmed.

Arch Linux 64-bit
Version: 6.2.0.0.alpha0+
Build ID: 5b42a17dc99fba2ccf8dd8d0a8e0e4e836e30120
CPU threads: 8; OS: Linux 4.17; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group threaded
Built on June 22nd 2018

Arch Linux 64-bit
Version: 6.0.4.2
Build ID: 6.0.4-1
CPU threads: 8; OS: Linux 4.16; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Comment 6 QA Administrators 2021-03-24 05:55:13 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2023-03-25 03:24:00 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2025-03-25 03:13:02 UTC Comment hidden (obsolete)
Comment 9 raal 2026-01-28 16:34:08 UTC
*** Bug 168186 has been marked as a duplicate of this bug. ***