[Libreoffice-bugs] [Bug 141103] New: use of SheetNames() in macro causes error when spreadsheet file is opened

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Mar 18 16:35:51 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=141103

            Bug ID: 141103
           Summary: use of SheetNames() in macro causes error when
                    spreadsheet file is opened
           Product: LibreOffice
           Version: 7.0.4.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: hrhall at msn.com

Created attachment 170555
  --> https://bugs.documentfoundation.org/attachment.cgi?id=170555&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210318/eb1af0fb/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list