Ich habe ein paar Makros zum Laden von Lotus Notes und zum Einfügen eines Anhangs und zum Senden von Makros gesehen. Es ist fast fertig, es sendet die E-Mail, aber nicht wissen, wie man einen Ordner sendet, es funktioniert mit einer PDF-Datei, aber ich habe eine Reihe von PDF-Dateien in einem Ordner, den ich senden möchte. Wie formatiere ich die E-Mail zu lesen: " HalloSo öffnen Sie eine Lotus Notes Neue Mail und senden
Bitte finden Befestigung
(Attachment)
Signature "
Jede Hilfe ist willkommen, Dank
Sub SendEmail()
Dim WatchRange As Range
Dim IntersectRange As Range
Dim x As Integer
Dim UserName As String
Dim MailDbName As String
Dim Recipient As Variant
Dim Maildb As Object
Dim MailDoc As Object
Dim Attachment As String
Dim Session As Object
Dim stSignature As String
With Application
.ScreenUpdating = False
.DisplayAlerts = False
' Open and locate current LOTUS NOTES User
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
' Create New Mail and Address Title Handlers
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
Maildb.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)
' Select range of e-mail addresses
MailDoc.SendTo = "joe bloggs"
MailDoc.subject = "Work"
MailDoc.Body = "Hello" & " " & " Please find attachment."
MailDoc.SAVEMESSAGEONSEND = True
Attachment = "c:\03-11\4267.pdf"
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "")
On Error Resume Next
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If
MailDoc.PostedDate = Now()
On Error GoTo errorhandler1
MailDoc.SEND 0, Recipient
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
.ScreenUpdating = True
.DisplayAlerts = True
On Error GoTo errorhandler1
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
End With
End Sub
Ich habe mein Makro geändert, es fügt jetzt hinzu Unterschrift, aber das Format ist falsch und es hängt die Datei nicht an.
Sub SendEmail()
Dim WatchRange As Range
Dim IntersectRange As Range
Dim x As Integer
Dim UserName As String
Dim MailDbName As String
Dim Recipient As Variant
Dim Maildb As Object
Dim MailDoc As Object
Dim Attachment As String
Dim Session As Object
Dim stSignature As String
Dim ws As Object 'Lotus Workspace
Dim objProfile As Object
Dim rtiSig As Object, rtitem As Object, rtiNew As Object
Dim uiMemo As Object
Dim strToArray() As String, strCCArray() As String, strBccArray() As String
Dim strTo As String, strCC As String, strBcc As String, _
strObject As String, strBody As String, strAttachment As String, blnSaveit As Boolean
Dim strSignText As String, strMemoUNID As String
Dim intSignOption As Integer
With Application
.ScreenUpdating = False
.DisplayAlerts = False
' Open and locate current LOTUS NOTES User
Set Session = CreateObject("Notes.NotesSession")
Set ws = CreateObject("Notes.NotesUIWorkspace")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
' Create New Mail and Address Title Handlers
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
stSignature = Maildb.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)
' Select range of e-mail addresses
MailDoc.SendTo = "JJunoir"
MailDoc.subject = ""
MailDoc.Body = "Hello" & " " & " Please find attachment,"
MailDoc.SAVEMESSAGEONSEND = True
Set objProfile = Maildb.GETPROFILEDOCUMENT("CalendarProfile")
intSignOption = objProfile.GETITEMVALUE("SignatureOption")(0)
strSignText = objProfile.GETITEMVALUE("Signature")(0)
Attachment = "c:\Debit Notes 03-11\"
If strAttachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", strAttachment, "Attachment")
On Error Resume Next
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If
'Open memo in ui
Set uiMemo = ws.EDITDOCUMENT(True, MailDoc)
Call uiMemo.GotoField("Body")
'Check if the signature is automatically inserted
If objProfile.GETITEMVALUE("EnableSignature")(0) <> 1 Then
If intSignOption = 2 Then
Call uiMemo.ImportItem(objProfile, "Signature_Rich")
End If
End If
Call uiMemo.GotoField("Body")
'Save the mail doc
strMemoUNID = uiMemo.DOCUMENT.UNIVERSALID
uiMemo.DOCUMENT.MailOptions = "0"
Call uiMemo.Save
uiMemo.DOCUMENT.SaveOptions = "0"
Call uiMemo.Close
Set uiMemo = Nothing
Set MailDoc = Nothing
'Get the text and the signature
Set MailDoc = Maildb.GETDOCUMENTBYUNID(strMemoUNID)
Set rtiSig = MailDoc.GETFIRSTITEM("Body")
Set rtiNew = MailDoc.CREATERICHTEXTITEM("rtiTemp")
Call rtiNew.APPENDTEXT(strBody)
Call rtiNew.APPENDTEXT(Chr(10)): Call rtiNew.APPENDTEXT(Chr(10))
Call rtiNew.APPENDRTITEM(rtiSig)
'Remove actual body to replace it with the new one
Call MailDoc.RemoveItem("Body")
Set rtitem = MailDoc.CREATERICHTEXTITEM("Body")
Call rtitem.APPENDRTITEM(rtiNew)
MailDoc.Save False, False
Set uiMemo = ws.EDITDOCUMENT(True, MailDoc)
MailDoc.PostedDate = Now()
On Error GoTo errorhandler1
MailDoc.SEND 0, Recipient
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
.ScreenUpdating = True
.DisplayAlerts = True
errorhandler1:
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
End With
End Sub
Dies ist, was es ohne Befestigung Mit freundlichen Grüßen J JuniorHello Bitte finden Befestigung produziert,
Ich habe das vorherige Makro zu diesem neuen Makro aktualisiert. Kann jemand diese Zeile erklären? Set AttachME = MailDoc.CREATERICHTEXTITEM ("Anhang") Set EmbedObj = AttachME.EMBEDOBJECT (1454, "", Anhang, "") –
Dies fügt jetzt eine neue Zeile MailDoc.Body = "Hello" & vbNewLine hinzu & vbNewLine & "Bitte Anhang finden", & vbNewLine. Ich versuche immer noch nach einer Lösung zu suchen, um eine Signatur hinzuzufügen. –