TerryJ wrote:

> I've had this problem for some time but it was highlighted today by my 
> experience with a working function posted in the forum ( 
> http://www.oooforum.org/forum/viewtopic.phtml?p=203524#203524 ):
> 
> Function foo(MyRange)
> da = 
> ThisComponent.CurrentController.ActiveSheet.getCellRangeByName(MyRange).getDataArray()

(snip)

> I entered a formula in the correct format in the spreadsheet, viz: 
> =foo(B1:B5) which generated two identical error messages "Basic runtime 
> error.  Object variable not set".  The line raising the error is the 
> first line in the script.

So one of the objects in your first doesn't exist (has an empty
reference). You can narrow it down by separating the calls:

doc = ThisComponente
ctrl = doc.CurrentController
sheet = ctrl.ActiveSheet
range = sheet.getCellRangeByName(MyRange)
data = range.getDataArray()

The best bet is that range does not exist so that the last line will
give you the "object variable not set" error or that sheet is zero
because you call the macro before the document is completely initialized
and you get the error in the line before the last one.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to