Hi all,

I've added a listner to a Calc cell.
Assigned Sub Main to Document Open.
Assigned Sub RemoveListener (see below) to Document Close.
However, this one causes an error. See comment marked with >> in line.

Couldn't find a solution easily (and didn't find courage to study the whole chapter about events and such ...)
Any idea what's wrong and how I can solve this?

Thanks,
Cor

global oListner0 as object
'also oListner1 and oListner2

Sub Main
  AddListners
End Sub

Sub AddListners
  Dim oCell
  Const sCellName as String  = "A1"

  oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName(sCellName)
oListner0 = CreateUnoListener( "A10_", "com.sun.star.chart.XChartDataChangeEventListener" )
  oCell.addChartDataChangeEventListener(oListner0)

 ' do the same for sheet(1) and (2)
End Sub

Sub RemoveListener
  Dim oCell
  ' removes the listener
  oCell = ThisComponent.Sheets.getByIndex(0).getCellByPosition(0, 0)
  oCell.removeModifyListener(oListner0)
*>>*
  ' Gives "Cannot coerce argument type during corereflection call"

  ' do the same for other listners
End Sub

Sub A10_chartDataChanged(oEvent)
 'do something
end sub


--

Cor Nouws
Arnhem - Netherlands
www.nouenoff.nl

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

Reply via email to