Sub Click(Source As Button)
Dim uidoc As NotesUIDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim agent As NotesAgent
Set db = s.CurrentDatabase
Dim ws As New NotesUIWorkspace
Set uidoc=ws.CurrentDocument
If uidoc.ModifiedSinceSaved=True Then
Call uidoc.Save
End If
Set doc1 = uidoc.Document
Call doc1.ReplaceItemValue("Principal","")
If doc1.Subject(0)="" Then
Call doc1.ReplaceItemValue("Subject",doc1.WebSubject(0))
Else
Call doc1.ReplaceItemValue("Subject",doc1.Subject(0))
End If
If doc1.SendTo(0)="" Then
send=doc1.EnterSendTo
copysend=doc1.EnterCopyTo
sendblind=doc1.EnterBlindCopyTo
Call doc1.ReplaceItemValue("Form","Memo")
Call doc1.ReplaceItemValue("SendTo",send)
Call doc1.ReplaceItemValue("BlindCopyTo",sendblind)
Call doc1.ReplaceItemValue("CopyTo",copysend)
Call doc1.Save( False, True )
Set agent = db.GetAgent("(mailsend)")
Call agent.RunOnServer(doc1.NoteID)
Call doc1.ReplaceItemValue("MailOptions", "0")
Call doc1.ReplaceItemValue("PostedDate", Now)
On Error Goto ErrH Call uidoc.Save
Call uidoc.Close
Call doc1.ReplaceItemValue("PostedDate", Now)
Set agent = db.GetAgent("(mailsend)")
Call agent.RunOnServer(doc1.NoteID)
Exit Sub
ErrH:
errMsg$ = Error$
Msgbox errMsg$,, "Lotus Notes..."
Exit Sub
End Sub