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
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Tamas Bunth
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:

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

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.

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

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

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:

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":


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:

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