Bug 52603 - Excel Visual Basic compatibility issue in LibreOffice Calc: "Application.ScreenUpdating = False" does not _always_ work!
Summary: Excel Visual Basic compatibility issue in LibreOffice Calc: "Application.Scre...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
3.5.5.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 149559 (view as bug list)
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2012-07-27 19:58 UTC by Tor24_1975314
Modified: 2022-06-20 02:52 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Excel test file with macro (38.00 KB, application/vnd.ms-excel)
2012-07-27 19:58 UTC, Tor24_1975314
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tor24_1975314 2012-07-27 19:58:51 UTC
Created attachment 64805 [details]
Excel test file with macro

The Excel Visual Basic code "Application.ScreenUpdating = False" does not work or will be ignored.
Because this code will be ignored it is not possible to disable the updating of the screen and some macros are working very slow in LibreOffice!

Try to run the example macro in Excel and compare it with LibreOffice Calc.
Example macro:

Sub Test_ScreenUpdating()
    ' Testing Excel VBA Code in Libre Office:
    Range("A4").Select
    Application.ScreenUpdating = False

    For i = 1 To 10000
        ActiveCell.Offset(1, 0).Select
    Next i
    
    Range("A4").Select
    Application.ScreenUpdating = True
End Sub
Comment 1 Tor24_1975314 2012-09-02 11:45:57 UTC
This bug occurs in LibreOffice version 3.5.6 and 3.6.1 also
Comment 2 Julien Nabet 2014-02-09 16:22:24 UTC
On pc Debian x86-64 with master sources updated yesterday, I can reproduce this.

Noel: I checked on Opengrok, a setScreenUpdating method exists but is never called, see:
http://opengrok.libreoffice.org/search?q=setScreenUpdating&project=core&defs=&refs=&path=&hist=
See also:
http://opengrok.libreoffice.org/search?q=ScreenUpdating&project=core&defs=&refs=&path=&hist=
Are we near the goal with all this?
Comment 3 Tor24_1975314 2014-02-18 18:49:30 UTC
This bug was also reproduced in newer versions of LibreOffice for Windows! 
Tested with LibreOffice versions: 4.0.4.2, 4.1.4.2 and 4.2.0.4

Moreover to that the last version of LibreOffice 4.2.0.4 shows a significant performance degradation to scroll down through cells via macro!!!

Needed time to scroll down through 10000 cells:
LibreOffice 4.0.4.2: 00:15 [mm:ss]
LibreOffice 4.1.4.2: 00:15 [mm:ss]
LibreOffice 4.2.0.4: 01:38 [mm:ss] (!!!)

Needed time with Excel to compare:
Excel 2010 with "Application.ScreenUpdating = False": ~00:01 [mm:ss]
Excel 2010 with "Application.ScreenUpdating = True" :  00:05 [mm:ss]

(Test system: Windows 7 64-bit, Intel Core2Duo P8700 2.53 Ghz, 4 GB RAM, Java SE Runtime Environment build 1.6.0_24-b07)

Could anybody reproduce the bug and the performance degradation in LibreOffice 4.2.0?
Comment 4 Tor24_1975314 2014-05-04 14:48:13 UTC
This bug was reproduced also in LibreOffice Calc version 4.2.3.3 and 4.2.4.1 rc!
Comment 5 QA Administrators 2015-06-08 14:41:26 UTC Comment hidden (obsolete)
Comment 6 Tor24_1975314 2015-06-15 21:43:02 UTC
The problem still exists!

This bug was also reproduced in LibreOffice 4.4.3.2!
Comment 7 Julien Nabet 2015-06-17 17:19:29 UTC
I searched a bit and all the mechanism for this seems to be there, here's a bt when I'm on "ScreenUpdating=false"

(gdb) bt
#0  0x00002aaaca2c5ae1 in ScModelObj::lockControllers() (this=0x29c1920) at /home/julien/compile-libreoffice/libreoffice/sc/source/ui/unoobj/docuno.cxx:1652
#1  0x00002aaaae1d86c7 in basic::vba::(anonymous namespace)::lclLockControllers(com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&, bool) (rxModel=uno::Reference to (ScModelObj *) 0x29c19b0, bLockControllers=true) at /home/julien/compile-libreoffice/libreoffice/basic/source/basmgr/vbahelper.cxx:110
#2  0x00002aaaae1d8b05 in basic::vba::(anonymous namespace)::lclIterateDocuments(basic::vba::(anonymous namespace)::ModifyDocumentFunc, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&, bool) (pModifyDocumentFunc=0x2aaaae1d8685 <basic::vba::(anonymous namespace)::lclLockControllers(com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&, bool)>, rxModel=uno::Reference to (ScModelObj *) 0x29c19b0, bModificator=true)
    at /home/julien/compile-libreoffice/libreoffice/basic/source/basmgr/vbahelper.cxx:164
#3  0x00002aaaae1d8c18 in basic::vba::lockControllersOfAllDocuments(com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&, bool) (rxModel=uno::Reference to (ScModelObj *) 0x29c19b0, bLockControllers=true) at /home/julien/compile-libreoffice/libreoffice/basic/source/basmgr/vbahelper.cxx:187
#4  0x00002aaacfaf5f15 in VbaApplicationBase::setScreenUpdating(unsigned char) (this=0x2e79030, bUpdate=0 '\000')
    at /home/julien/compile-libreoffice/libreoffice/vbahelper/source/vbahelper/vbaapplicationbase.cxx:193

Eike: any idea why the document view locking mechanism doesn't work here?
Comment 8 Tor24_1975314 2016-06-26 14:29:36 UTC
This problem still exists and was reproduced in LibreOffice versions 4.4.7.2, 5.0.4.2, 5.1.1.3 and 5.1.4.2 for Windows.

(Test system: Windows 7 64-bit, Intel Core2Duo P8700 2.53 Ghz, 4 GB RAM, Java SE Runtime Environment build 1.6.0_24-b07)
Comment 9 Xisco Faulí 2017-06-12 11:53:55 UTC
Changing version back to the earliest affected version.
Comment 10 Tor24_1975314 2017-11-05 20:48:07 UTC
Bug also reproduced with LibreOffice version 5.4.2 (Version 5.4.2.2 for Windows)
Comment 11 QA Administrators 2019-07-30 03:15:41 UTC Comment hidden (obsolete)
Comment 12 CM 2019-12-11 10:13:52 UTC
Bug also reproduced with LibreOffice Version 6.3.3.2 (x64) for Windows.  W10 platform. Tested using Calc.
lockControllers / unlockControllers  doesn't function either and may be related.
It would be really useful to get this fixed for performance reasons.
Comment 13 Óvári 2022-06-20 00:12:33 UTC
*** Bug 149559 has been marked as a duplicate of this bug. ***
Comment 14 Óvári 2022-06-20 00:25:29 UTC
The ScreenUpdating.xls Excel spreadsheet [attachment](https://bugs.documentfoundation.org/attachment.cgi?id=180744) at bug 149559 has two functions, whereby "Application.ScreenUpdating = False" fails and the other that works.

They can be found by:
1. Macro Selector
2. Library: ScreenUpdating.xls → VBAProject → ThisWorkbook
3. Macro Name: Either "ScreenUpdateTestFails" or "ScreenUpdateTestWorks"

Tested with:
Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: ca47989ad60b1414f92be22a1fbf4c1d1a92dd97
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

using Linux Mint 20.3 Cinnamon.

Does the testcase help solve this issue?

Thank you
Comment 15 Óvári 2022-06-20 00:36:44 UTC
"Excel test file with macro" bug also reproduced with LibreOffice:

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: ca47989ad60b1414f92be22a1fbf4c1d1a92dd97
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

with Linux Mint 20.3 Cinnamon.

Thank you