mit diesem Code:
Code: Alles auswählen
Option Explicit
Const EMBED_ATTACHMENT As Long = 1454
Const stSubject As String = "Einsatzplan"
Const vaMsg As Variant = "falls man das möchte, hier einen vorgefertigten text"
Const vaCopyTo As Variant = "hobbit@test.de"
Sub Send_Active_Fahrer1()
Dim stFileName As String
Dim vaRecipients As Variant
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
Dim workspace As Object
Dim noEmbedObject As Object
Dim noAttachment As Object
Dim stAttachment As String
' erstellt das PDF von Seite 1 im gleichen Ordner, wie sich das Workbook befindet
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\Einsatzplan.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=False, IgnorePrintAreas:=True
' Bereitstellung des Emailanhangs
stAttachment = ThisWorkbook.Path & "\Einsatzplan.pdf"
' Empängerliste (bei automatischem Versand) Array
vaRecipients = VBA.Array("hobbit@Test.de")
' Laden der Lotus COM Objekte
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'Falls Notes nicht geöffnet ist
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
' Email erstellen
Set noDocument = noDatabase.CreateDocument
Set noAttachment = noDocument.CreateRichTextItem("stAttachment")
Set noEmbedObject = noAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
With noDocument
.Form = "Memo"
.sendTo = vaRecipients
.copyTo = vaCopyTo
' vorgegebens Subjekt
.subject = stSubject
' Input Box
'.Subject = InputBox("Please Enter the Message Subject", "Message Subject")
'.Body = vaMsg
.SaveMessageOnSend = True
.PostedDate = Now()
'.Send 0, vaRecipients
End With
Set workspace = CreateObject("Notes.NotesUIWorkspace")
Call workspace.EDITDOCUMENT(True, noDocument).GOTOFIELD("Body")
' Speicher leeren
Set noEmbedObject = Nothing
Set noAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
' MsgBox
MsgBox "Die Mail ist erstellt. Bitte wechseln Sie zu NOTES", vbInformation
End Sub
Dein Code hat leider nicht geklappt.
Wo könnte jetzt noch der Fehler liegen?