我想在Lotus Notes 9邮件正文中添加一个文件,而不是作为旁边的附件文件

我自动化服务,我能够使用xls vba代码创build一个邮件,但我的问题是,该文件被附加在邮件正文的外部,而我想有以下情况:

Mail Body text... attached file text... End of the mail Body 

我使用了下面的代码

 Sub Send_Email_via_Lotus_Notes() Dim oSession ' AS NotesSession Dim strServer Dim strUserName Dim strMailDbName Dim oCurrentMailDb ' as NOTESDATABASE Dim oMailDoc ' as NOTESDOCUMENT Dim ortItem ' as NOTESRICHTEXTITEM Dim ortAttachment ' as NOTESRICHTEXTITEM Dim oEmbedObject ' as ???? Dim cstrAttachment Dim blAttachment Dim serialNumber As String Dim ticketNumber As String ticketNumber = Range("C7").Value serialNumber = Range("C19").Value cstrAttachment = "C:\dummy.txt" blAttachment = True ' Start a session to notes Set oSession = CreateObject("Notes.NotesSession") strServer = oSession.GETENVIRONMENTSTRING("MailServer", True) strUserName = oSession.UserName strServer = oSession.GETENVIRONMENTSTRING("MailServer", True) strUserName = oSession.UserName strMailDbName = Left(strUserName, 1) & Right(strUserName, (Len(strUserName) - InStr(1, strUserName, ""))) & ".nsf" ' open the mail database in Notes Set oCurrentMailDb = oSession.CURRENTDATABASE If oCurrentMailDb.IsOpen = False Then MsgBox "## Opening Lotus Notes mail database..." oCurrentMailDb.OPENMAIL End If ' Create a document in the back end Set oMailDoc = oCurrentMailDb.CREATEDOCUMENT ' Set the form name to memo oMailDoc.form = "Memo" With oMailDoc .SendTo = "antonio.zasa@it.ibm.com" '.BlindCopyTo = "mgreen@ozemail.com.au" '.CopyTo = "migreen@westpac.com.au" .Subject = "ACTION REQUIRED - Format the disk/s of your system in de-activation and sign the related form" End With Set BoldBlueStyle = oSession.CREATERICHTEXTSTYLE Set NormalStyle = oSession.CREATERICHTEXTSTYLE With BoldBlueStyle .NOTESFONT = DEFAULT_SANS_SERIF .FontSize = 14 .NOTESCOLOR = COLOR_BLUE .Bold = True End With With NormalStyle .NOTESFONT = DEFAULT_SANS_SERIF .FontSize = 12 .NOTESCOLOR = COLOR_BLACK .Bold = False End With Set obAttachment = oMailDoc.CREATERICHTEXTITEM("cstrAttachment") Set ortItem = oMailDoc.CREATERICHTEXTITEM("Body") With ortItem .APPENDTEXT ("Hi") .ADDNEWLINE (1) .APPENDTEXT ("This note is related to the de-acativation of the system/s owned by you requested by the SR:") .ADDNEWLINE (1) .APPENDSTYLE (BoldBlueStyle) .APPENDTEXT ("=================================================================") .ADDNEWLINE (1) .ADDTAB (2) .APPENDTEXT ("SR# System S/N") .ADDNEWLINE (1) .ADDTAB (2) .APPENDTEXT ("") + ticketNumber .ADDTAB (3) .APPENDTEXT ("") + serialNumber .ADDNEWLINE (1) .APPENDTEXT ("=================================================================") .ADDNEWLINE (2) .APPENDSTYLE (NormalStyle) .APPENDTEXT ("As part of the new De-Activation (DeEoS) process,") .ADDNEWLINE (2) .APPENDTEXT ("https://securelinux.romelab.it.ibm.com/security/Process_EoS.html") .ADDNEWLINE (2) .APPENDTEXT ("you are required for the distruction of the residual IBM Confidential Information from the") .ADDNEWLINE (1) .APPENDTEXT ("Hard Disk/s.") .ADDNEWLINE (1) .APPENDTEXT ("Once you have performed the format of the disk/s:") .ADDNEWLINE (2) .APPENDTEXT (" 1 - Download the precompiled form from this note") .ADDNEWLINE (1) .APPENDTEXT (" 2 - Print and Sign it") .ADDNEWLINE (1) .APPENDTEXT (" 3 - Make available the signed form to the operator who will pick up your system.") .ADDNEWLINE (2) .APPENDTEXT ("The signed form will be archived, and made ··available for future reference.") .ADDNEWLINE (2) .APPENDSTYLE (BoldBlueStyle) .APPENDTEXT ("================= Form To Download and sign =====================") .ADDNEWLINE (2) End With With obAttachment Set EMBEDOBJECT = obAttachment.EMBEDOBJECT(EMBED_ATTACHMENT, "", cstrAttachment, "Attachment" ) End With With ortItem .APPENDTEXT ("<SR_<Ticket Number>_formatting.pdf> ") .APPENDTEXT ("=================================================================") .ADDNEWLINE (2) .APPENDSTYLE (NormalStyle) .APPENDTEXT ("For the NON intel systems, the destruction of the residual data can be usually done, using the") .ADDNEWLINE (1) .APPENDTEXT ("appropriate installation CD/DVD of the involved OS.") .ADDNEWLINE (2) .APPENDTEXT ("For the Intel based systems, this operation can be done, burning a CD,on another system, using") .ADDNEWLINE (1) .APPENDTEXT ("the iso downloadable from ISSI at the link showed below: ") .ADDNEWLINE (2) .APPENDTEXT (" http://ibmurl.hursley.ibm.com/45PX ") .ADDNEWLINE (2) .APPENDTEXT ("You can burn the formatting CD also on another machine, and use it on the system under") .ADDNEWLINE (1) .APPENDTEXT ("DeEos (De Activation).") .ADDNEWLINE (2) .APPENDTEXT ("Many Thanks.") .ADDNEWLINE (4) .APPENDTEXT ("Cordiali Saluti / Best Regards") .ADDNEWLINE (1) .APPENDTEXT ("________________________________________") .ADDNEWLINE (1) .APPENDTEXT ("IBM Software Group Tivoli - Rome") .ADDNEWLINE (1) .APPENDTEXT ("Via Sciangai 53 - 00144 Rome Italy") .ADDNEWLINE (1) .APPENDTEXT ("+39 06 59660166") .ADDNEWLINE (1) .APPENDTEXT ("antonio.zasa@it.ibm.com") .ADDNEWLINE (1) .APPENDTEXT ("________________________________________") End With MsgBox "## Sending email..." With oMailDoc .PostedDate = Now() .SAVEMESSAGEONSEND = "True" .SEND (False) End With MsgBox "## Sent !" ' close objects Set oMailDoc = Nothing Set oCurrentMailDb = Nothing Set oSession = Nothing End Sub 

我想知道如何让文件“正文”正文文本,而不是外部附件的身体。

谢谢

只需将附件添加到您的ortItem RichText项“ ortItem

 With ortItem ... .EMBEDOBJECT(EMBED_ATTACHMENT, "", cstrAttachment, "Attachment" ) 

您不需要额外的obAttachment RichText项目。