Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As notesuidocument
Set uidoc =workspace.currentdocument
uidoc.EditMode = True
Dim doc As NotesDocument
Set doc = uidoc.document
Dim targetdb As NotesDatabase
Set targetdb = session.CurrentDatabase
If Not targetdb.isopen Then
Msgbox "The Target Database could not be opened." , 0 + 16
Print "The Target Database could not be opened."
Exit Sub
End If
Dim x As Integer
Dim AgentArray() As String
Redim AgentArray(x) As String
Forall agent In targetdb.Agents
If AgentArray(0) = "" Then
AgentArray(x) = Ucase(agent.Name)
Else
x = x + 1
Redim Preserve AgentArray(x) As String
AgentArray(x) = Ucase(agent.Name)
End If
End Forall
Call SortArray(AgentArray)
Dim agentNameIist
agentNameIist = workspace.Prompt(PROMPT_OKCANCELLIST, "Choose Agent", "Please select the agent to process.", "" , AgentArray )
Dim item As NotesItem
Set item = doc.GetFirstItem( "target_agent" )
If item Is Nothing Then
doc.GSMUsersHost = agentNameIist
Else
Call item.AppendToTextList(agentNameIist)
End If
Call uidoc.Refresh
Print "Agent Set"
End Sub