Bug 151393 - Auto_Open should not run from ThisWorkbook
Summary: Auto_Open should not run from ThisWorkbook
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.5.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2022-10-06 18:00 UTC by Justin L
Modified: 2022-10-11 23:15 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
autoOpenClose.xls: various oddities with auto_open in Excel (27.50 KB, application/vnd.ms-excel)
2022-10-06 18:00 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2022-10-06 18:00:27 UTC
Created attachment 182883 [details]
autoOpenClose.xls: various oddities with auto_open in Excel

The auto_ functions are not supposed to run from ThisWorkbook (Excel 2003/2010).

This changed in LO 7.4 with commit beb6c62e990599d91ac5d9183164c94d269027d3
Author: Tomaž Vajngerl on Mon Jan 31 15:46:30 2022 +0900
    vba: fix registering shortcuts keys defined by the vba macros
Comment 1 Justin L 2022-10-06 18:05:17 UTC
Steps to reproduce
1.) Open autoOpenClose.xls and allow macros to run
2.) Accept MsgBox from ThisWorkbook.WorkBook_Open macro.
3.) That should be it. However, we have a second msgbox opening for ThisWorkbook.auto_open. This second one should not run (tested Excel 2010/2003).
Comment 2 Justin L 2022-10-07 20:08:24 UTC
Prior to Tomaž' patch, hasMacro could return true if
sMod.isEmpty() and a Module named sMacroName has a "Main" macro.

I think that might have been for MS Word's benefit. At least AutoOpen works that way (although our code didn't get the macroURL right). It is probably better that it doesn't return true, but just noting the difference.
Comment 3 Commit Notification 2022-10-11 18:39:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ffc15725b58d0988b4e2ed836c5751223ad00984

tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheet

It will be available in 7.5.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.