次のエージェントは、2 番目の段落のテキストを取得します。
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim rtnavBody As NotesRichTextNavigator
Dim rtrangePara As NotesRichTextRange
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
REM Get second paragraph in Body item
REM Set range and navigator for it
Set rtnavBody = body.CreateNavigator
If Not rtnavBody.FindNthElement(RTELEM_TYPE_TEXTPARAGRAPH, 2) Then
Messagebox "Body item does not have two paragraphs",, _
"Error"
Exit Sub
End If
Set rtrangePara = body.CreateRange
Call rtrangePara.SetBegin(rtnavBody)
Messagebox rtrangePara.TextParagraph,, "Text of second paragraph"
End Sub