次のコードは、エージェントのプロファイル結果を UI 文書として開きます。
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim doc As NotesDocument
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim agentNames() As String
Dim i As Integer
Set db = session.CurrentDatabase
' Build list of agent names and have user select one
i = 0
Forall a In db.Agents
Redim Preserve agentNames(0 To i)
agentNames(i) = a.Name
i = i + 1
End Forall
title = ws.Prompt(PROMPT_OKCANCELLIST, "Agent name", _
"Select the agent to be viewed", agentNames(0), agentNames)
If Isempty(title) Then Exit Sub
' Get the selected agent then its performance document
Set agent = db.GetAgent(title)
Set doc = agent.GetPerformanceDocument
If doc Is Nothing Then
Messagebox "No profiling results",, title
Exit Sub
End If
' Open the performance document for viewing
Set uidoc = ws.EditDocument(False, doc)
End Sub