Hey guys!
I’ve been trying to write some UDF’s, but due to my lack of experience with BASIC I’ve no clue what exactly went wrong.
The functions themselves work as I expect them to, but every time I open the document I use them in the following error message appears:
(The error occurs not only in line 11, but in line 18 as well)
After hitting the OK Button for eight times (I call the functions a total of seven times), the sheets appear and a part of the cells using these functions have the value “#REF!”.
To make them display the correct value again I have to edit a random cell manually and hit enter (probably triggering a refresh of all sheet calculations?).
Any help is greatly appreciated.
REM ***** BASIC *****
sub Main
end sub
function getLastSheetname()
dim lastSheet as object
dim lastIndex as integer
lastIndex = ThisComponent.Sheets.Count
lastSheet = ThisComponent.Sheets(lastIndex - 1)
getLastSheetname = lastSheet.getName
end function
function getfirstSheetname()
getfirstSheetname = ThisComponent.sheets(0).getName
end function