作者:绿色风
分类:
时间:2022-08-17
浏览:98
楼主 omnw |
Q:如何用VBA发送NOTES邮件? A:例如如下代码,可以将指定的附件发送给多个收件人。 FileSelf参数为附件的完整路径。 vaRecipient参数为收件人列表。
- Sub SendWithLotus(FileSelf As String, vaRecipient As Variant)
- Dim noSession As Object, noDatabase As Object
- Dim noDocument As Object, noAttachment As Object
- Dim i As Long
- Dim stSubject As String
- Dim stMsg As String
- Const EMBED_ATTACHMENT = 1454
- stSubject = FileSelf
- stMsg = "Bst & Rgds" & vbCrLf & Application.UserName & vbCrLf & vbCrLf & "**************************************************************************" & vbCrLf & "(This's an automated e-mail notification, please do not reply this message.)"
- Set noSession = CreateObject("Notes.NotesSession") 'Insert Lotus Notes COM object.
- 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"
- End Sub
使用方法:
- Sub 发送NOTES邮件()
- SendWithLotus ThisWorkbook.FullName, VBA.Array("min yu/Accounting/HuaAn@HuaAn", "junhu li/Register Dept/HuaAn")
- End Sub
NOTES.rar |
2楼 卖火柴的帅哥 |
附件运行时提示错误 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一