Notes via VBA
Frank
ich bin leider noch nicht weiter gekommen und verweise nochmal auf meinen Beitrag von gestern (https://www.herber.de/forum/archiv/908to912/t909845.htm)
Die Fehlermeldung ... 7063 ... kommt weiterhin!
Wie kann ich feststellen ob die SET-Operation gelungen sind?
Gibt es eine weitere Prüfmöglichkeit ob die Datenbank geöffnet ist?
Wer kennt mögliche Einstellungen in LoNo die das öffnen der DB verhindern?
Jeder Tip ist willkommen - ich lade euch auch zum Kaffee ein ;-))
Frank
Lasst mich nicht hängen, ihr habt mir doch bisher auch immer geholfen!
~t~
Public Sub SendNotesMail(Subject, Recipient, BodyText, Attachment) '(Subject As String, _
Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean) 'Set up the objects required for Automation into lotus notes
'On Error GoTo Fehler
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Variant 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Set Session = CreateObject("Notes.NotesSession") 'Start a session to notes
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & _
".nsf"
Set Maildb = Session.GetDatabase("", MailDbName) 'Open the mail database in notes
If Maildb.ISOPEN = True Then
'Already open for mail
Else
'Session.initialize
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = True
If Attachment "" Then 'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM(Attachment)
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
MailDoc.CREATERICHTEXTITEM ("attachment")
End If
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.SEND 0, Recipient
'Clean Up
MsgBox "Die Mail wurde an " & Recipient & " versendet!", vbInformation, "Mailversand"
Unload UF_MailVersenden
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
Exit Sub
Fehler:
Text = "Mail versenden. Empfänger: " & Recipient
Call ErrorHandler(Text)
End Sub
~t~