I need your help to figure out what's happening or what am I doing wrong!
when I run a macro from the menu Tools -> Macros -> Run Macro ..., I've got what I expected but, if I call a function from a cell, on which it calls the macro itself, I dont have what I expect.
The following example explains better the issue. In this example, I putted the background color of the cell A1 as red and the cell C1 has a call to the function like this:
=SETCOLORF(D1)
so that when I put somethind on Cell D1, the function setColorF is called automatically.
Code: Select all
Function setColorf ( )
setColorM
End Function
Sub setColorM
Dim oDocument as Object
Dim oController as Object
Dim oConfSheet as Object
Dim oSelectorSheet as Object
Dim oLocalCell as Object
Dim oRemoteCell as Object
Dim iRow as Integer
oDocument = ThisComponent
oController = oDocument.GetCurrentController
oSheets = oDocument.Sheets
oSelectorSheet = oController.getActiveSheet()
oLocalCell = oSelectorSheet.GetCellByPosition(0,0)
oRemoteCell = oSelectorSheet.GetCellByPosition(0,1)
oRemoteCell.CellBackColor = oLocalCell.CellBackColor
End Sub
The function is not updating the background color!
Test case: clear the background color of Cell A2 and fill the cell D1 with something.
Can you tell me what have I done wrong or Is there some answer I should attend to?
Thanks in advance.