在需要发送EMAIL的程序中写以下VBA程序,其中strEMailRecipient,strSubject,strBody分别是邮件接收地址,邮件标题和邮件内容,均为字符串。
Set appOutlook = Getobject ("Outlook.Application")
Set msg = appoutlook.CreateItem(olMailItem)
with msg
.To = strEMailRecipient
.Subject = strSubject
.Body = strBody
.sent
End With
appOutlook类型为 Outlook.Application
msg类型为 Outlook.MailItem
如果有多个发件人帐户,在OUTLOOK上可以通过MailItem的属性SendUsingAccount指定帐户,但这个属性值的类型并不是string,而是Account类型的,这个可以通过Application.Session.Accounts(i)来指定;
本文介绍了如何使用VBA在程序中通过Outlook发送电子邮件,包括设置收件人、主题和正文,以及处理多账户发送时如何指定SendUsingAccount的Account类型。

653

被折叠的 条评论
为什么被折叠?



