VBA从第二个Outlook电子邮件地址发送电子邮件 [英] VBA Send Email from Second Outlook Email Address
本文介绍了VBA从第二个Outlook电子邮件地址发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码在Excel中使用VBA通过Outlook发送电子邮件。我在Outlook中设置了两个电子邮件地址。我想从我的辅助电子邮件帐户发送电子邮件。我该怎么办?
I am using the following code to send emails through Outlook using VBA in Excel. I have two emails addresses set up in Outlook. I'd like to send the email from my secondary email account. How would I do that?
Dim objOL
Dim objAppt
Const olAppointmentItem = 1
Const olMeeting = 1
Set objOL = CreateObject("Outlook.Application")
Set objAppt = objOL.CreateItem(0)
With objAppt
.display
End With
signature = objAppt.HTMLBody
With objAppt
.to = Range("H3").Value
.Subject = Range("L3").Value
.CC = Range("K3").Value
.HTMLBody = Body
.display 'display not send
End With
Set objAppt = Nothing
Set objOL = Nothing
推荐答案
将MailItem.SendUsingAccount属性设置为Namespace.Accounts集合中的Account对象之一。
Set the MailItem.SendUsingAccount property to one of the Account objects from the Namespace.Accounts collection.
这篇关于VBA从第二个Outlook电子邮件地址发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文