Das Notes Forum

Domino 9 und frühere Versionen => ND7: Administration & Userprobleme => Thema gestartet von: ramki am 16.08.11 - 10:46:59

Titel: eMail MIT ANHANG aus Excel in LotusNotes 7 erstellen ANHANG = Problem
Beitrag von: ramki am 16.08.11 - 10:46:59
Hallo zusammen,

ich habe mich extra hier angemeldet, da ich an einer Stelle nicht weiterkomme und hoffe,
dass Ihr mir weiterhelfen könnt.

Per Excel-Makro versende ich ein eMail, dass neben Text auch noch einen Zellbereich als
eingefügtes Bild verschickt.
Nun soll zusätzlich noch eine bestimmte Excel-Datei als Anhang mit verschickt werden. Und
genau da komme ich nicht weiter, weil ich die entsprechenden Befehle und Deklarationen
nicht kenne. Folgenden Code nutze ich (funktioniert tadellos). Kann mir jemand dabei helfen,
wie ich hier jetzt noch ein Dateianhang einbauen kann?

Vielen Dank, Gruß,
ramki

Sub test()

Dim uiworkspace As Object
Dim uidoc As Object


Range("bild").Select   'Zellbereich für das einzufügende Bild (entsprech. Name vergeben)
Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap

Set uiworkspace = CreateObject("Notes.NotesUIWorkspace")
Set uidoc = uiworkspace.COMPOSEDOCUMENT("", "", "Memo")

   With uidoc
    .GoToField ("To")
    .inserttext ("ram.ki@testing.com")

    .GoToField ("Subject")
    .inserttext ("test")
   
    .GoToField ("Body")
    .inserttext ("und jetzt kommt das Bild, . . ." & vbCrLf & vbCrLf)
    .Paste   'fügt das Bild ein

    .inserttext (vbCrLf & vbCrLf & "erfolgreich?" & vbCrLf & vbCrLf & _
    vbCrLf & "Freundliche Grüße")

    ' UND HIER SOLL JETZT NOCH EIN DATEIANHANG UNTER DEN TEXT. ABER WIE ????
   
   
   .Send
 .Close
End With

Set uiworkspace = Nothing
Set uidoc = Nothing
End Sub
Titel: Re: eMail MIT ANHANG aus Excel in LotusNotes 7 erstellen ANHANG = Problem
Beitrag von: Axel am 16.08.11 - 12:32:12
Guckst du hier:

http://atnotes.de/index.php/topic,48306.0.html (http://atnotes.de/index.php/topic,48306.0.html)
http://atnotes.de/index.php/topic,46636.0.html (http://atnotes.de/index.php/topic,46636.0.html)

Das sind nur zwei Threads aus denen du entsprechende Infos ziehen kannst.

Bitte zuerst immer die Forensuche benutzen. Sehr viele Probleme wurden hier schon mehrfach behandelt. Wenn du dann nicht weiterkommst helfen wir gerne.

Axel
Titel: Re: eMail MIT ANHANG aus Excel in LotusNotes 7 erstellen ANHANG = Problem
Beitrag von: ramki am 16.08.11 - 13:25:59
Danke Axel,

hab's auch inzwischen endlich hinbekommen.

So funktioniert's:

Sub Test()


Dim session As Object
Dim db As Object
Dim doc As Object
Dim strTo As Variant
Dim strPath As String
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim AttachME As Object 'The attachment richtextfile object
Dim Workspace As Object
Dim uidoc As Object
   
    strdatei = "\\defs01\AMCP\ISIS_Export\DIE.xls"


Set session = CreateObject("Notes.NotesSession")
Set db = session.GetDatabase("", "")
If db.IsOpen = False Then db.OPENMAIL


Set doc = db.CreateDocument
With doc
    .form = "Memo"
    .SendTo = "ramon@testing.com"
    .Subject = "Test"
    .SaveMessageOnSend = True

    Set AttachME = doc.CreateRichTextItem("Attachment")
    Set EmbedObj = AttachME.EmbedObject(1454, "", strdatei, "")
   
    .PostedDate = Now()
End With

Set Workspace = CreateObject("Notes.NotesUIWorkspace")
Set uidoc = Workspace.EDITDOCUMENT(True, doc)

With uidoc
    .GOTOFIELD ("Body")
    .inserttext ("Hallo," & vbCrLf & vbCrLf)
    Range("a1:C3").Copy
    .Paste
    .inserttext (vbCrLf & vbCrLf & "Hier der Anhang:" & vbCrLf & vbCrLf & vbCrLf)
    .Send
    .Close
End With


Set EmbedObj = Nothing
Set AttachME = Nothing
Set uidoc = Nothing
Set Workspace = Nothing
Set db = Nothing
Set doc = Nothing
Set session = Nothing

End Sub

Gruß,
Ramon