@Bernhard,
hier der gesamte Code
Sub Click(Source As Button)
Dim uiws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim session As New notessession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Set uidoc = uiws.currentdocument
Set doc = uiws.currentdocument.document
'//-------- Text modules----------------------
Title$ = "Document control"
MsgAlreadySent$ = "Already sent..."
MsgSendTo$ = "Field [Send to] must contain at least one person."
MsgSaveBeforeSubmit$ = "Request must be saved prior submit."
subject_text$ = "Decision of Deviation Request for customer: "
txt$="Sending of decision successfully initiated."
txt2$="Replicate immediately."
If doc.DocStatus(0) = "2" Then
Messagebox MsgAlreadySent$, mb_ok, Title$
Continue = False
Exit Sub
End If
'######Das geht nich#####################
If Not Isnumeric(doc.WSBCApprCost) Then
Messagebox "Numeric characters only.", MB_OK + MB_ICONSTOP, Title$
Continue = False
Exit Sub
End If '######################################
If doc.SendTo(0) = "" Then
Messagebox MsgSendTo$, mb_ok, Title$
Continue = False
Exit Sub
End If
'//--- Write current Notes user
Dim benutzer As Variant, zeit As Variant
Const formel = "@V3UserName"
benutzer = Evaluate(formel)
Const formel2 = "@text(@Now)"
zeit = Evaluate(formel2)
'--- Write name and time stamp into fields
Call uidoc.FieldSetText("WSBCDecSender", benutzer(0))
Call uidoc.FieldSetText("WSBCDecDate", zeit(0))
Dim dStatus As String
dStatus = "2"
Call uidoc.FieldSetText("DocStatus", dStatus)
Call uidoc.Save()
'//--- Submit the document
Dim st_originator As String
Dim doc_send As notesdocument
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
Set db = session.currentdatabase
Set doc_send = New notesdocument(db)
Dim st_Text As String, send2 As String, copy2 As String, subject As String
send2 = doc.SendTo(0)
copy2 = doc.CopyTo(0)
subject = subject_text$
'// Set Form Type, Subject, SendTo address, CopyTo address
Call doc_send.replaceitemvalue("form", "Memo")
Call doc_send.replaceitemvalue("Subject", subject & doc.CustomerName(0))
Call doc_send.replaceitemvalue("SendTo", send2)
Call doc_send.replaceitemvalue("CopyTo", copy2)
'// Build Richtext for Message Body
Set RTItem = New NotesRichTextItem(doc_send, "body")
Call RTItem.addnewline(2)
Call RTItem.addnewline(2)
Call RTItem.AppendText("Please follow this doclink to the request in the DQMS database. ")
Call RTItem.AppendDocLink(doc, "DQMS request document")
'//-------- Send Document -----
Call doc_send.send(False)
'//-------- Final popup messages -----------------------
Messagebox txt$,mb_ok,"Notice"
Messagebox txt2$,mb_ok,"Important notice"
'//----------------------------------------------------------------
Call uidoc.Close
Continue = True ' No Error
docIsSaved = True
End Sub
Gruss Ewald