Bug 107902 - Macro in XLSM gives error in Calc, but runs fine in Excel
Summary: Macro in XLSM gives error in Calc, but runs fine in Excel
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Tamas Bunth
URL:
Whiteboard: target:7.1.0
Keywords: bibisected, bisected, filter:xlsx, regression
Depends on:
Blocks: XLSX Macro-VBA 111833
  Show dependency treegraph
 
Reported: 2017-05-16 22:48 UTC by Aron Budea
Modified: 2020-07-10 15:36 UTC (History)
4 users (show)

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


Attachments
Sample XLSM that gives error in Calc when run (13.62 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-05-16 22:48 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2017-05-16 22:48:08 UTC
Created attachment 133368 [details]
Sample XLSM that gives error in Calc when run

Open the attached Excel spreadsheet with a simple macro, and run the macro. 

Execution fails with error:
"BASIC runtime error.
'1'

Type: com.sun.star.lang.WrappedTargetRuntimeException
Message: non-RuntimeException occurred when accessing an interface type attribute"

There's no error message if the first line of the macro is changed
- from: Range("A1").Select
- to:   Range("A1:A5").Select

In Excel the macro runs fine in both cases.

Occurs in 5.4 master build (68a1cb23ede1d4ae6195850190fca6953c30417f) / Windows 7, doesn't occur in 5.2.0.4. => regression
Comment 1 Aron Budea 2017-05-16 22:52:11 UTC Comment hidden (bibisection)
Comment 2 Aron Budea 2017-05-16 22:54:42 UTC
The issue started with the commit referenced below.
Seems like the issue is with determining whether the autofiltered column includes a header or not. Even if there is no error, the first cell is among the autofiltered entries, while before the commit it isn't.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=4cd9e45a439b654c8e1ff7983fe7e4bd073b9c92
author		Yan Pashkovsky <yanp.bugz@gmail.com>	2016-08-12 20:39:30 (GMT)
committer	Eike Rathke <erack@redhat.com>	2016-08-18 13:50:30 (GMT)

"tdf#91305 fix sort calc"
Comment 3 Xisco Faulí 2017-05-17 08:57:31 UTC
Confirmed in

Version: 5.4.0.0.alpha1+
Build ID: 74d2e606fd3605fe0a585f596eaa215ae4e20d18
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; 
Locale: fo-FO (ca_ES.UTF-8); Calc: group

@Eike, would you mind taking a look at it when you have some time ?
Comment 4 Tamas Bunth 2017-08-10 20:35:02 UTC
I couldn't reproduce it.

Method 'HasColHeader()' is not called in AutoFilter because of this patch:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=7e728965b3f5a37a6f0bd75d616d2acb16c40f71
Comment 5 Aron Budea 2017-08-15 23:47:11 UTC
Verified there's no error in the following daily build anymore:
2017-08-15_01:59:49 (bebaac5eb6ebd2db3e1ea22b1630111343a9c25c) / Windows 7.
Comment 6 Commit Notification 2020-07-10 15:36:18 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/88424a4adca388c8708b164751a4144a62814224

tdf#107902: sc_macros_test: Add unittest

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.