Bug 141103 - use of SheetNames() in macro causes error when spreadsheet file is opened
Summary: use of SheetNames() in macro causes error when spreadsheet file is opened
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.4.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-18 16:35 UTC by Henry Hall
Modified: 2022-08-25 03:44 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
PDF of screenshot of error message (40.46 KB, application/pdf)
2021-03-18 16:35 UTC, Henry Hall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Hall 2021-03-18 16:35:51 UTC
Created attachment 170555 [details]
PDF of screenshot of error message

spreadsheet file with 4 sheets.  In cell B9 (of the first sheet) is entered {TRANSPOSE(SheetNames())}.  When constructing the spreadsheet no errors result.  The column B10 - B13 contains (correctly) the names of the 4 sheets (or tabs).  The cells on the first sheet behave as expected (using the indirect function) and properly display contents of cells in sheets 2, 3, and 4.  The file is then saved and closed.

When is it opened later, an error results.  A window opens containing "My Macros & Dialogs..." appears.  The function causing the error is:

Function SheetNames()
SheetNames = ThisComponent.Sheets.getElementNames()
End Function

The 2nd line of this function is highlighted and a message box appears, declaring "Basic runtime error.
Property or method not found: Sheets."

The cells on the first sheet do not show what is expected, instead they contain:
#N/A

Strangely, however, if I re-calculate (Data>Calculate>Recalculate hard) everything works.  So I can live with this situation, but it is annoying and (I think) it ought to be fixed.

I've attached a screenshot of the initial display upon opening.
Comment 1 raal 2022-01-24 18:12:29 UTC
Hello,

Thank you for filing the bug. Please send us a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO', so please do change it back to 'UNCONFIRMED' once you have attached a document.
(Please note that the attachment will be public, remove any sensitive information before attaching it.)
How can I eliminate confidential data from a sample document?
https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F
Thank you
Comment 2 QA Administrators 2022-07-25 03:28:06 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2022-08-25 03:44:16 UTC
Dear Henry Hall,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp