Verständnisfrage Excel und Lotus-Notes
22.01.2004 12:23:35
Michael O.
ich habe hier im Achriv schon (fast) die Lösung meines Problems gefunden.
der Code funktioniert super gut bis auf eine kleinigkeit.
unten weiter steht
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.SEND 0, Recipient
in "Recipient" stehen die Empfänger für das Mail, doch wenn dort mehr als 1 Empfänger drin steht wird der 2 Empfänger ab dem @-zeichen verstümmelt und die danach sind garnicht mehr da :-(
Gibt es eine Möglichkeit mehrere Empfänger einzugeben?? Über eine Gruppenbildung im Lotus-Notes geht es! Aber dann müsste jeder Benutzer meiner Tabellen sich eine entsprechende Gruppe im Notes einrichten. Ich wollte aber eigentlich aus einem Tabellenblatt die gewünschten Empfänger auslesen. Aber wie gesagt es geht nur einer. Kann ich außerdem das "Sofortige" Senden verhindern? sondern nur ein neues Mail erzeugen und dann mit Hand zu versenden??
Danke für die hoffentlich hilfreichen Antworten
Gruß
Michael O.
Option Explicit
Function SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)
Dim Maildb As Object 'Die Mail-Datenbank
Dim UserName As String 'Der Notes-Benutzername des SENDENDEN Users
Dim MailDbName As String 'Der Name der Maildatenbank des SENDENDEN Users
Dim MailDoc As Object 'Das Mail-Dokument selbst
Dim AttachME As Object 'Das Attachment-Richtextfile-Object
Dim Session As Object 'Die Notes-Session
Dim EmbedObj As Object 'Das Attachment
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
'Already open for mail
Else
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 = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
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
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Function