| Option Explicit |
| |
| Sub lotus() |
| |
| Dim sText As String, sEmpfang As String, sBetrifft As String |
| Dim session As Object, db As Object, doc As Object, rtobject As Object |
| Dim rtitem As Object, sKopie As String |
| Dim AttachMe As Object, DerAnhang As Object |
| Dim user As String, server As String |
| Dim mailfile As String, sBlindKopie As String |
| Dim vAn As Variant, vCopy As Variant |
| Dim vBlind As Variant, sAnhang As String |
| Dim stSignature As String |
| |
| |
| On Error GoTo Fehler |
| |
| |
| sEmpfang = "test" ' Einträge durch " ; " getrennt |
| Debug.Print sEmpfang |
| sBetrifft = "Test" ' die Betreffzeile |
| Debug.Print sBetrifft |
| sText = "funktioniert es? " ' Testtext |
| Debug.Print sText |
| sKopie = " " ' Einträge durch " ; " getrennt |
| Debug.Print sText |
| sBlindKopie = " " ' Einträge durch " ; " getrennt |
| Debug.Print sBlindKopie |
| vAn = Split(sEmpfang, " ; ") ' Empfänger Array |
| Debug.Print vAn |
| sAnhang = "" ' richtiger Pfad Muss natürlich richtig gesetzt werden |
| Debug.Print sAnhang |
| If Len(sKopie) > 0 Then vCopy = Split(sKopie, " ; ") 'cc Array |
| If Len(sBlindKopie) > 0 Then vBlind = Split(sBlindKopie, " ; ") 'bcc Array |
| |
| |
| Set session = CreateObject("notes.notessession") ' Notes muss gestartet sein |
| Debug.Print session |
| user = session.UserName |
| Debug.Print user |
| server = session.GetEnvironmentString("MailServer", True) |
| Debug.Print server |
| mailfile = session.GetEnvironmentString("MailFile", True) |
| Debug.Print mailfile |
| Set db = session.getdatabase(server, mailfile) |
| Set doc = db.createdocument() |
| |
| doc.form = "Memo" |
| Debug.Print doc.form |
| doc.sendTo = vAn ' an array |
| Debug.Print doc.sendTo |
| If Len(sKopie) > 0 Then doc.copyto = vCopy 'cc Array |
| If Len(sBlindKopie) > 0 Then doc.blindcopyto = vBlind 'bcc Array |
| |
| doc.Subject = sBetrifft ' die Betreffzeile |
| Debug.Print doc.Subject |
| stSignature = db.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0) |
| Debug.Print stSignature |
| Set rtitem = doc.CREATERICHTEXTITEM("body") |
| Debug.Print rtitem |
| Call rtitem.APPENDTEXT(sText & stSignature) |
| Debug.Print rtitem |
| doc.SAVEMESSAGEONSEND = True |
| doc.PostedDate = Now |
| |
| ' ******************************************* |
| If sAnhang <> "" Then |
| Set AttachMe = doc.CREATERICHTEXTITEM("Attachment") |
| Set DerAnhang = AttachMe.EMBEDOBJECT(1454, "", sAnhang, "Attachment") |
| End If |
| |
| |
| '******************************* |
| |
| Call doc.Send(False) |
| |
| Fehler: |
| MsgBox "Fehler in Sub Fehler 0 Erste Division" & vbCrLf _ |
| & "Fehlernummer: " & Err.Number & _ |
| vbCrLf & "Fehlerbeschreibung: " & Err.Description |
| |
| |
| Aufraeumen: |
| On Error GoTo Fehler |
| Set rtitem = Nothing |
| Set AttachMe = Nothing |
| Set DerAnhang = Nothing |
| Set db = Nothing |
| Set doc = Nothing |
| Set session = Nothing |
| Exit Sub |
| |
| End Sub |