Mailversand Lotus Notes
30.01.2004 13:56:29
Stephan
Ich weiß, dass es jede Menge Postings zu diesem Thema gibt. Leider finde ich keines, welches mir ein Beispiel an die Hand gibt, wie ich ein einzelnes Tabellenblatt aus Excel heraus über Lotus Notes versenden kann.
Emails über lotus notes versenden funktioniert...
Aber wie bekomme ich ein Tabellen-Blatt ind den Body?
folgenden Code verwende ich:
Function SendNotesMail(sTo As String, _
sCC As String, _
sBCC As String, _
sSubject As String, _
sBody As String, _
sNotesServer As String, _
sMailFile As String)
Dim oSession As Object
Dim oDB As Object
Dim oDoc As Object
Dim oBody As Object
' Dim oAttachment As Object
' Dim oWorkspace As Object
' Dim iEMBED_ATTACHMENT As Integer
' 'use these if you need to launch Notes
' Set oWorkspace = CreateObject("Notes.NotesUIWorkspace")
' Call ws.OpenDatabase("", "test4.nsf") 'this does not have to be a user's normal mail file
'establish Notes session
Set oSession = CreateObject("Notes.NotesSession")
'create a link to the database object
Set oDB = oSession.GetDatabase(sNotesServer, sMailFile)
'create a new "Memo" document for the database
Set oDoc = oDB.CreateDocument
oDoc.Form = "Memo"
'create a link to the form's body field
Set oBody = oDoc.CreateRichTextItem("Body")
Dieser Part funktioniert nicht
' 'Attach a File '.EmbedObject( type%, class$, source$, [ name$ ] )
' On Error Resume Next
' Do
'' Error = 0
' iEMBED_ATTACHMENT = iEMBED_ATTACHMENT + 1
' Set oAttachment = oBody.EmbedObject(iEMBED_ATTACHMENT, "","C:\Temp\Test123.xls", [ "Test123.xls" ])
' Loop Until oBody.EmbeddedObjects.Count > 0
' Debug.Print iEMBED_ATTACHMENT
'give it a subject
oDoc.Subject = sSubject
'set the SendTo field to the list of recipients (stored with the form if it is saved)
oDoc.SendTo = Array(sTo)
oDoc.CopyTo = Array(sCC)
oDoc.BlindCopyTo = Array(sBCC)
'create and append body details to the document
Call oBody.Appendtext(sBody)
'send the doc
oDoc.ReturnReciept = True
oDoc.SaveMessageOnSend = True
Call oDoc.Send(False) ', oDoc.SendTo)
' 'save the doc
' Call oDoc.Save(True, False)
'Clean-up: Delete all references to Notes objects
Set oBody = Nothing
Set oDoc = Nothing
Set oDB = Nothing
Set oSession = Nothing
End Function
Danke