次のエージェントは、現在の文書の最初の表の内容を青に変えます。
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 rtrangeTable As NotesRichTextRange
Dim style As NotesRichTextStyle
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
REM Get first table in Body item
REM Set range for it
Set rtnavBody = body.CreateNavigator
If Not rtnavBody.FindFirstElement(RTELEM_TYPE_TABLE) Then
Messagebox "Body item does not contain a table,",, _
"Error"
Exit Sub
End If
Set rtrangeTable = body.CreateRange
Call rtrangeTable.SetBegin(rtnavBody)
Call rtrangeTable.SetEnd(rtnavBody)
REM Create style
Set style = session.CreateRichTextStyle
style.NotesColor = COLOR_BLUE
REM Set table to blue
Call rtrangeTable.SetStyle(style)
Call doc.Save(True, True, True)
End Sub