Calc macro, how to find the address of a selected cell?

I have this code:

sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim oSel as object, oSheet as object
rem ----------------------------------------------------------------------
rem get access to the document
oSheet=thiscomponent.getcurrentcontroller.activesheet
oSel = ThisComponent.getCurrentSelection()
print oSel.value
end sub

How do get the address of oSel in eg “$H$6” format so I can paste data in that cell which I copied from another cell in a fixed location?

You can change the data in the Cell by using

oSel.Value = the new value

You can get the cell address by using the property

oSel.AbsoluteName

To see all the properties of oSel use

MsgBox oSel.dbg_properties

and to see all the methods that can be applied to oSel use

MsgBox oSel.dbg_methods

You can use these calls on any Object that is visible in a Macro.

Thank you. My macro is working fine now.