| Function NotesMail_senden(strSendTo As String, _ |
| strCopyTo As String, _ |
| strBlindCopyTo As String, _ |
| strSubject As String, _ |
| strMessage As String, _ |
| strAttachment As String, _ |
| Optional bolSenden As Boolean = True) |
| |
| On Error GoTo NotesMail_Err |
| |
| Dim Workspace As Object |
| |
| Dim NotesSession As Object |
| Dim NotesDatabase As Object |
| Dim NotesDocument As Object |
| Dim NotesRTStyle As Object |
| Dim NotesRTItem As Object |
| Dim NotesATTACHMENT As Object |
| Dim sMessage As String |
| |
| |
| Set NotesSession = CreateObject("Notes.Notessession") |
| |
| |
| Set NotesRTStyle = NotesSession.CreateRichTextStyle |
| |
| |
| Set NotesDatabase = NotesSession.GetDatabase("", "") |
| NotesDatabase.OpenMail |
| |
| |
| Set NotesDocument = NotesDatabase.CreateDocument |
| |
| |
| Set NotesRTItem = NotesDocument.CreateRichTextItem("Body") |
| |
| |
| |
| If strAttachment <> "" Then Set NotesATTACHMENT = NotesRTItem.EMBEDOBJECT(1454, "", strAttachment, "Sample") |
| |
| |
| sMessage = strMessage |
| |
| |
| NotesRTStyle.NotesFont = 4 |
| |
| NotesRTStyle.NotesColor = 2 |
| NotesRTStyle.FontSize = 10 |
| |
| Call NotesRTItem.AppendStyle(NotesRTStyle) |
| Call NotesRTItem.AppendText(sMessage) |
| |
| |
| |
| With NotesDocument |
| .Form = "Memo" |
| .ReplaceItemValue "SendTo", strSendTo |
| .ReplaceItemValue "CopyTo", strCopyTo |
| .ReplaceItemValue "BlindCopyTo", strBlindCopyTo |
| .ReplaceItemValue "Subject", strSubject |
| |
| |
| If bolSenden = True Then |
| .SAVEMESSAGEONSEND = True |
| .PostedDate = Now(): |
| .Send True |
| Else |
| Set Workspace = CreateObject("Notes.NotesUIWorkspace") |
| Call Workspace.EditDocument(True, NotesDocument).GotoField("Body") |
| |
| End If |
| End With |
| |
| Set NotesRTItem = Nothing |
| Set NotesRTStyle = Nothing |
| Set NotesDocument = Nothing |
| Set NotesDatabase = Nothing |
| Set NotesSession = Nothing |
| |
| |
| |
| Exit Function |
| |
| NotesMail_Err: |
| MsgBox Err.Description, vbExclamation, "Fehler! (" & Trim$(Str$(Err)) & ")" |
| End Function |