Ask Your Question

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

asked 2015-10-24 20:29:24 +0100

rlp1938 gravatar image

updated 2018-12-30 14:22:41 +0100

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
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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-16 00:14:35.177520

1 Answer

Sort by » oldest newest most voted

answered 2015-10-26 18:04:23 +0100

peterwt gravatar image

updated 2015-10-26 18:26:05 +0100

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
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.

edit flag offensive delete link more


Thank you. My macro is working fine now.

rlp1938 gravatar imagerlp1938 ( 2015-10-28 14:43:45 +0100 )edit

Question Tools

1 follower


Asked: 2015-10-24 17:15:00 +0100

Seen: 1,264 times

Last updated: Dec 30 '18