Hi,
Is someone has any idea on how to replace a keyword - like - by a doclink inside a RichText item? I was able to do that by getting the plain text of the rich tet item, but I then loose all the formatted text and attachments.
Here below is the scripts that I wrote.
Thank you!
Function IncludeDocLink( rtSource As NotesRichTextItem, dLien As NotesDocument, rtDest As NotesRichTextItem ) As Variant
'This function look for the keyword “” and replace it by a doclink
Dim strTextRemaining As String
Dim strTextBefore As String
Dim strTextAfter As String
Dim intPositionTexte As Integer
IncludeDocLink = False
strTextRemaining = rtSource.GetFormattedText( False, 0 )
Do
intPositionTexte = Instr( 1, strTextRemaining, "<LienDoc>",5 )
If intPositionTexte > 0 Then
IncludeDocLink = True
strTextBefore = Left( strTextRemaining, intPositionTexte - 1)
strTextAfter = Right(strTextRemaining, Len(strTextRemaining)-intPositionTexte - Len("<LienDoc>") + 1)
Call rtDest.AppendText( strTextBefore )
Call rtDest.AppendDocLink(dLien, "Lien au document/Link to document")
strTextRemaining = strTextAfter
Else
If IncludeDocLink Then Call rtDest.AppendText( strTextRemaining )
End If
Loop Until intPositionTexte < 1
If Not IncludeDocLink Then 'The keywork has not been not found
Call rtDest.AppendDocLink(dLien, "Lien au document/Link to document")
End If
End Function