I wrote a libreoffice BASIC macro function under My Macro & Dialogs -> Standard -> Module1
. It envokes .Sheets()
method:
Function tester(n As Long)
tester = ThisComponent.Sheets(n).GetName
End Function
If I did’t reopen the file, everything went right. Writing =tester(0)
in a cell gives Sheet1
, the default sheet name, correctly.
However, the following error message appears every time upon reopening the saved .ods file.
BASIC Runtime Error: Property or method not found: Sheets.
And it disappears after re-typing the saved formula.
I would like to know: (1) What causes this, and (2) How can I still use Sheets()
or other worksheet function such as Sheet()
without this trouble IN GENERAL? Thanks!
version: Libreoffice Calc 5.0.5.2
OS: win10 x64