Examples: TextParagraph property
This agent searches for the first occurrence of a string in a text paragraph in an item.
Dim session As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtrange As NotesRichTextRange
Sub Initialize
Set session = New NotesSession
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
If dc.Count = 0 Then
Messagebox "No document selected",, "No doc"
Exit Sub
End If
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
Set rtnav = body.CreateNavigator
Set rtrange = body.CreateRange
If rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
searchString$ = Inputbox$("Enter search string:", _
"Search string")
Do
Call rtrange.SetBegin(rtnav)
If Instr(rtrange.TextParagraph, searchString$) <> 0 Then
Messagebox _
"Text paragraph: " & rtrange.TextParagraph _
,, "Found """ & searchString$ & """"
Exit Sub
End If
Loop While rtnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Messagebox searchString$,, "Not in Body"
Else
Messagebox "No element of this type in Body",, _
"No paragraph"
End If
End Sub