I am trying to use the hyperlink function from calc in a macro, following the official guide [Using Calc Functions in Macros] but the when calling the code in a cell it doesn’t show anything, but its returning an object, i know because i checked the result with ‘TypeName’, i can’t find how to solve it or how to work with returned objects, help?
This is the code i am using
REM ***** BASIC *****
Function ReturnTwitterHyperlink(TwitterLink As String)
Dim initiateAt As Integer
Dim endsAt as Integer
Dim shortName as String
sFunctions = createUnoService("com.sun.star.sheet.FunctionAccess")
initiateAt = InStr(TwitterLink, ".com/") + 5
endsAt = InStr(initiateAt, TwitterLink, "/")
shortName = Mid(TwitterLink, initiateAt, (endsAt - initiateAt))
hyperArgs1 = "https://" & TwitterLink
hyperArgs2 = shortName
result = sFunctions.callFunction( "HYPERLINK", Array(hyperArgs1, hyperArgs2) )
ReturnTwitterHyperlink = result
End Function
Edit: Adding example
i want to call that on a cell with a link (in this case twitter), and get a hyperlink same as the Hyperlink function but slicing from the link a string to be used as the cell text, like this:
=RETURNTWITTERHYPERLINK("twitter.com/XData/status/1782772388343521457"
)
and get
Basically, a custom Hyperlink function