Hello, I’ve just started learning to use Calc and have no experience using macros so I am, in effect, a potato when it comes to spreadsheet programming.
My aim is to copy an array of cell addresses to the system clipboard so that I can paste them into a text file for regex manipulation.
I have managed to get the output to be printed in a dialogue box with the following:
Sub GetSelectedCellAddresses
Dim myController as Object, myRange as Object
myController = ThisComponent.getCurrentController()
myRange = myController.getSelection()
print myRange.AbsoluteName
End Sub
I am interested in getting the printed range of cell addresses copied directly to the system clipboard with a success notification.
Using this helpful resource, I’ve cobbled together this disaster:
Sub GetSelectedCellAddresses
Dim myController as Object, myRange as Object, document as Object, dispatcher as Object
myController = ThisComponent.getCurrentController()
myRange = myController.getSelection()
Dim args1() as String
args1() = myRange.AbsoluteName
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, args1())
msgbox "Cell addresses copied to the clipboard"
End Sub
Unsurprisingly, it doesn’t work. Could anyone help me?
Thanks in advance.