Excel-Seite per Lotus Notes mailen
17.04.2008 20:13:25
jens
Habe ein kleines Problem beim Versenden von Excel über Lotus Notes.
Ein Programm für Lotus-Notes habe ich freundlicherweise über dieses Forum schon erhalten,
mir fehlt nur noch ein Befehl, das Übernehmen/Kopieren eines Bereichs (Range("A1:C30") nach Lotus.
Da, wo der Befehl reinpassen könnte, habe ich eine Anmerkung gemacht.
'
Public Sub SendNotesMail(Subject As String, ABBachment As String, Recipient As String, BodyText _
_
As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim BodyText As String 'Probeweise eingefügt
Dim Maildb As Object 'The mail daBTAbase
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail daBTAbase name
Dim MailDoc As Object 'The mail document itself
Dim ABBachME As Object 'The aBBachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (ABBachment)
'Prüfen,ob e-mail Adresse hinterlegt ist
If [C14] = "" Then
[C14].Select
MsgBox Prompt:="Keine e-Mail Adresse hinterlegt"
End
End If
'Festlegung der Variablen
N1 = [C14] 'Empfänger
N2 = [B1] 'Datum
N3 = [C15] 'Betreff
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Set meinNotes = 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 daBTAbase 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 = N1 ' Empfänger
MailDoc.sendcc = "" 'Kopie
MailDoc.Subject = N3 ' 'Subject,Betreff z.B. "KundendiensBTAuftrag"
'Textfeld für die Mail, wird jedoch erst nach dem Replizieren angezeigt
'Jetzt könnte der Befehl kommen, behelfe mich zur Zeit über die Variable Text Brief
BodyText = TextBrief
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and aBBachment and aBBach it
If ABBachment "" Then
Set ABBachME = MailDoc.CREATERICHTEXTITEM("ABBachment")
Set EmbedObj = ABBachME.EMBEDOBJECT(1454, "", ABBachment, "ABBachment")
MailDoc.CREATERICHTEXTITEM ("ABBachment")
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 ABBachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
MsgBox Prompt:="e- mail gesendet"
Application.ScreenUpdating = True
End Sub