为什么我发送的MAIL,附件和信息只能发送其中之一,不能同时包含. 当有下面蓝色语句时只能发附件,收到的邮件没有stMsg, 取消蓝色语句后能收到stMsg. Sub SendWithLotus() Dim noSession As Object, noDatabase As Object Dim noDocument As Object, noAttachment As Object Dim FileSelf As String Dim i As Long Const EMBED_ATTACHMENT = 1454 Const stSubject As String = "For Lotus VBA Programming Test only" Dim stMsg As String FileSelf = ThisWorkbook.Path + "\" + ThisWorkbook.Name stMsg = "Bst & Rgds" & vbCrLf & _ Application.UserName & vbCrLf & _ vbCrLf & _ "**************************************************************************" & vbCrLf & _ "(This's an automated e-mail notification, please do not reply this message.)" Dim vaRecipient As Variant vaRecipient = VBA.Array("someone@company.com") 'Insert Lotus Notes COM object. Set noSession = CreateObject("Notes.NotesSession") Set noDatabase = noSession.GETDATABASE("", "") If noDatabase.IsOpen = False Then noDatabase.OPENMAIL Set noDocument = noDatabase.CreateDocument Set noAttachment = noDocument.CreateRichTextItem("Body") noAttachment.EmbedObject EMBED_ATTACHMENT, "", FileSelf With noDocument .Form = "Memo" .SendTo = vaRecipient .Subject = stSubject .Body = stMsg .SaveMessageOnSend = True .PostedDate = Now() .Send 0, vaRecipient End With Set noDocument = Nothing Set noDatabase = Nothing Set noSession = Nothing AppActivate "Microsoft Excel" MsgBox "This file be sent", vbInformation End Sub
[此贴子已经被作者于2006-11-29 12:54:01编辑过] |