Estrarre link da cella
Thanks to www.pitonyak.org
piccola marco che estrae i(l) link(s) dalla cella e li scrive nella cella a destra separati da ###
Sub FindHyperLinkInCell
Dim oCell, oText, oParEnum, oParElement
Dim oEnum, oElement
Dim urlo
dim document as object
dim dispatcher as object
oCell = ThisComponent.Sheets(0).getCellByPosition(7, 5)
oParEnum = oCell.getText().createEnumeration()
Do While oParEnum.hasMoreElements ()
oParElement = oParEnum.nextElement()
oEnum = oParElement.createEnumeration()
Do While oEnum.hasMoreElements ()
oElement = oEnum.nextElement()
If oElement.TextPortionType = "TextField" Then
If oElement.TextField.supportsService("com.sun.star.text.TextField.URL") Then
'STRING Representation =
'STRING TargetFrame =
'STRING URL =
urlo = urlo & " ### " & oElement.TextField.URL
End If
End If
Loop
Loop
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args5(1) as new com.sun.star.beans.PropertyValue
args5(0).Name = "By"
args5(0).Value = 1
args5(1).Name = "Sel"
args5(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args5())
' urlo = "pipo"
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "StringName"
args2(0).Value = urlo
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2())
End Sub