Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
372to376
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
372to376
372to376
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Mailversand Lotus Notes

Mailversand Lotus Notes
30.01.2004 13:56:29
Stephan
Hallo zusammen!
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

8
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Mailversand Lotus Notes
30.01.2004 14:23:16
Bertram
Hallo Stephan,
so funktioniert's bei mir:


Private Sub CmdSend_Click()

Dim session As Object
Dim db As Object
Dim doc As Object
Dim strPath As String
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim AttachME As Object 'The attachment richtextfile object
''Mail erstellen
Set session = CreateObject("Notes.NotesSession")
Set db = session.CURRENTDATABASE
Set doc = db.CREATEDOCUMENT
doc.Form = "Memo"
doc.SendTo = "Test@Test.com"
doc.CopyTo = "Test2@Test2.com"
doc.Subject = "Test"
doc.body = "Das ist ein Test"
doc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = doc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", "C:\Testpfad\Test.xls")
doc.PostedDate = Now()
Call doc.send(False, "Test@Test.com")
Set db = Nothing
Set doc = Nothing
Set session = Nothing
End Sub

     Code eingefügt mit Syntaxhighlighter 2.5

Vielleicht hilfts dir ja.
Gruß
Bertram
Anzeige
AW: Mailversand Lotus Notes
30.01.2004 14:34:58
Stephan
Bekomme in folgender Zeile von VBA gesagt, das ein Objekt erwartet wird.
(Laufzeitfehler 424)

Set AttachME = doc.CREATERICHTEXTITEM("Attachment")
AW: Mailversand Lotus Notes
30.01.2004 14:45:46
Bertram
Bin leider gerade an einem Rechner ohne Lotus Notes.
Kann also leider nicht ausprobieren, woran's liegt.
Ist denn Lotus Notes geöffnet und deine Absender Mailbox aktiv?
Gruß
Bertram
AW: Mailversand Lotus Notes
30.01.2004 14:48:39
Stephan
Hallo Bertram,
yep Notes und Mailbox waren aktiv...
Ich hab mal meinen anderen Code gepostet... vielleicht hast Du
oder jemand anderes eine Idee wie ich ein Tabellen/Arbeitsblatt anhängen kann...
DANKE!
AW: Mailversand Lotus Notes
30.01.2004 14:46:15
Stephan
Hier mal mein code...
Die Fragezeichen stehen für meine "Wissenslücke"....


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
'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")
'Attach a File '.EmbedObject( type%, class$, source$, [ name$ ] )
???????????
'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

Anzeige
AW: Mailversand Lotus Notes
30.01.2004 15:04:10
Bertram
Hello again,
hast du's mal mit CURRENTDATABASE anstatt mit GetDatabase versucht?
Mit GetDatabase hab ich keine Erfahrung.
Gruß
Bertram
AW: Mailversand Lotus Notes
30.01.2004 15:08:41
Stephan
Hallo Bertram...
wenn Du getdatabase nutz ist es nicht nötig Notes offen zu haben...
Naja.. soweit klappt das Mailen mit dem vorhandenen Code.. brauche halt nur Ersatz für die ??? um ein Attachment einzufügen...

Bis denne
NOCH OFFEN
30.01.2004 15:18:57
Bertram
Sorry, kann dir im Moment nicht weiterhelfen:-(
Gruß
Bertram

132 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige