Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim doc As notesdocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Dim User As String
Dim J As Integer
Dim X As Integer
User = session.commonusername
'Check If the user has signed-off already
Dim item As NotesItem
Set item = doc.GetFirstItem( "TargetEmail" )
If item.Contains(Trim(Cstr(User))) Then
If uidoc.editmode = False Then
uidoc.EditMode = True
End If
'Gather Info from original targetemail field
Dim targetarray() As String
Redim targetarray(0 To Ubound(doc.TargetEmail)) As String
For J = 0 To Ubound(doc.TargetEmail)
TargetArray(J) = doc.TargetEmail(J)
Next J
'Blank out targetemail field
doc.TargetEmail = ""
'Repopulate targetemail field
For x = 0 To Ubound(targetarray)
If Not User = Cstr(TargetArray(x)) Then
If doc.TargetEmail(0) = "" Then
doc.TargetEmail = TargetArray(x)
Else
Set item = doc.GetFirstItem( "TargetEmail" )
Call item.AppendToTextList(Cstr(TargetArray(x)))
End If
End If
Next x
Dim newitem As NotesItem
Set newitem = doc.GetFirstItem("SignedOff")
Call newitem.AppendToTextList(Cstr(User & " on " & Now))
Call uidoc.Save
Call uidoc.close
End If
End Sub