获取经理电子邮件并添加到TO

时间:2014-03-24 07:18:23

标签: vba email outlook outlook-vba

如何获取经理电子邮件(员工报告的人员"展望属性>组织")以自动将其添加到代码中?

如果我对经理电子邮件进行硬编码,但代码有效,但我想将其应用于经理不同的不同部门。

' Sending a copy of the email to the supervisor
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")

Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "Please review the below email sent by an employee from your division" _
& vbCrLf & _
"**********************************************************" _
& vbCrLf & _
Item.Body
oMail.Subject = Item.Subject & " (Email Revision)"
oMail.To = **((MANAGER'S EMAIL))**
oMail.Send
Set oMail = Nothing
Set oApp = Nothing

1 个答案:

答案 0 :(得分:2)

尝试Application.CurrentUser.AddressEntry.GetExchangeUser()。Manager。

准备好处理GetExchangeUser和Manager返回null。