I have a comment in one cell, I would like to get the string out of the comment as a value in another cell

In Excel

Function getComment(xCell As Range) As String
On Error Resume Next
getComment = xCell.Comment.Text
End Function


I can’t do the equivalent in LibreOffice Calc

@DanielinBow I saw your comment Checked the code again - it works

This is an example of the code from this answer - CommentFromCell.ods

Please explain in detail what exactly does not work.