[Solved][Calc] CurrentController not available for function

Keyboard macros or custom scripts

[Solved][Calc] CurrentController not available for function

Postby Bidouille » Wed Sep 13, 2017 7:18 pm


Tested with AOO 4.1.3 and Win7 x64 Pro

I stored this function in a spreadsheet:
Code: Select all   Expand viewCollapse view
Function TEST(sCell)
    oDoc = thisComponent
= oDoc.currentController
= oCtrl.activeSheet
= oSheet.getCellRangeByName(sCell)
    Test = sCell & " contains: " & oCell.string
End function

This works if I input this formula:
Code: Select all   Expand viewCollapse view

But when I (re)load the document, I got: "Error, undefined object variable"

I don't know why CurrentController is void.
Functions must be calculated after document is loaded.
Did you think is a bug?
(9.48 KiB) Downloaded 30 times
Last edited by Bidouille on Mon Oct 02, 2017 11:23 am, edited 1 time in total.
User avatar
Posts: 213
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: [Calc] CurrentController is not available for function

Postby Villeroy » Wed Sep 13, 2017 7:46 pm

The document is calculated before rendering. There is no controller when this happens. Use ordinary references. =TEST(A1) refers to A1 on the same sheet as the formula cell.
If you need another type of referencing because you need access to the cell object you may consider this: https://forum.openoffice.org/en/forum/v ... =21&t=2762
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Posts: 25361
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 3 guests