Bug 37240 - [BASIC]"thisComponent.currentController.activeSheet" gives error when loading spreadsheet
Summary: [BASIC]"thisComponent.currentController.activeSheet" gives error when loading...
Status: RESOLVED DUPLICATE of bug 53899
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-15 17:46 UTC by andréb
Modified: 2016-05-26 12:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Test document showing the problem (9.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-12-22 19:09 UTC, 25pietro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andréb 2011-05-15 17:46:38 UTC
LibreOffice version is 3.3.2 (000330m19 - build:202) ; Fr, official version.

The hardware is x86, OS is Mandriva Linux 2010.2 (expect unrelated to problem.)
----

"thisComponent.currentController.activeSheet" is supposed to define as an object the active sheet of the active spreadsheet.

(e.g. oSheet = thisComponent.currentController.activeSheet)

This works correctly if the spreadsheet is already loaded.

If the macro is a function, and is contained in the spreadsheet in question, when loading the spreadsheet an error is produced once for every time the macro is invoked in the spreadsheet :
"variable object not defined."  (message translated from French)

A partial workaround exists, using either
 'thisComponent.Sheets.getByIndex(n-base-0)'
or
 'thisComponent.Sheets.getByName("name...")'

However this workaround requires that the macro knows which sheet one wishes to use for the calculation, whereas '.activesheet' automatically selects the currently active sheet.  (That is, the sheet in which is located the macro reference.)

I suspect that the problem arises because the focus is not yet defined when recalculations are being done on loading the sheet.  However the focus should be taken from the sheet in which the function is used.

After the spreadsheet is loaded, '.activesheet' works fine using either ctrl/shift/f9 to recalculate all cells (even if another sheet is active),
 or modifying a cell using the macro function. 

Note that this problem exists also for OpenOffice 3.2.1.4 (OOO320m15 build:9492)
Comment 1 Björn Michaelsen 2011-12-23 12:06:12 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 2 Florian Reisinger 2012-08-14 13:59:51 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 3 Florian Reisinger 2012-08-14 14:01:00 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 4 Florian Reisinger 2012-08-14 14:05:44 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 5 Florian Reisinger 2012-08-14 14:07:45 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 6 25pietro 2012-12-22 19:09:39 UTC
Created attachment 71988 [details]
Test document showing the problem

If you open the file you get an error message since the focus is not yet taken by the active sheet
Comment 7 25pietro 2012-12-22 19:13:02 UTC
I can confirm that the problem described is present in 3.5.4.2 under ubuntu 12.04
Comment 8 Joel Madero 2014-11-04 03:31:35 UTC
Never confirmed by QA team - moving to UNCONFIRMED.
Comment 9 andréb 2014-11-07 09:29:11 UTC
(In reply to Joel Madero from comment #8)
> Never confirmed by QA team - moving to UNCONFIRMED.

Since there is a test document submitted to confirm the bug, by someone other than the bug reporter, it is appropriate that it should be considered confirmed.
The definition of "confirmed" does not require review by the QA team.
Correcting status to "new" (which means confirmed).
Comment 10 Caolán McNamara 2016-05-26 12:45:27 UTC
This particular example works for me, but I believe its same general problem as 53899

*** This bug has been marked as a duplicate of bug 53899 ***