Ask Your Question

Calc - selecting a named range and copying it in the clipboard [closed]

asked 2014-03-05 22:53:36 +0200

Luc gravatar image

updated 2020-08-05 23:47:14 +0200

Alex Kemp gravatar image

I searched an entire day and could not find any answer. This relates to calc automation / basic.

Let's say I have a named range called "Details" in a given sheet of a calc document. I want the range to be selected and then copied to the windows clipboard for manual pasting in a non libreoffice application. Can anyone help me ? Thanks in advance.

Would it be possible to copy the named range to the windows clipboard without selecting the range ?

Would it be possible to do this without viewing the calc document (i.e. hidden) ?

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-02-20 08:03:55.226307

1 Answer

Sort by » oldest newest most voted

answered 2014-03-12 19:51:37 +0200

Luc gravatar image

updated 2014-03-15 22:15:19 +0200

manj_k gravatar image

If you need an answer, here is what I found: oClasseur > pointer to the calc document

                Set oNamedRanges = oClasseur.namedranges
                Set oRange = oNamedRanges.getbyname("Details")
                Set oReferredCells = oRange.getreferredcells()
                sContent = oRange.getcontent()
                sFeuille = Mid(sContent, InStr(sContent, "=$'") + 3, InStr(sContent, "'.") - InStr(sContent, "=$'") - 3)
                Set oCCCalc = oClasseur.currentcontroller()
                Set oFeuille = oClasseur.getsheets().getbyname(sFeuille)
                oCCCalc.Select (oFeuille.getcellrangebyname("Détails"))
                oDispatcher.executeDispatch oCCCalc.Frame, ".uno:Copy", "", 0, Array()

4 days to find out by myself how to do such a simple thing... good bye everyone !

edit flag offensive delete link more


Offensive contents removed...

manj_k gravatar imagemanj_k ( 2014-03-15 22:15:52 +0200 )edit

Question Tools

1 follower


Asked: 2014-03-05 22:53:36 +0200

Seen: 786 times

Last updated: Mar 15 '14