我在Excel上有一个收件人列表(或电子邮件地址)。有没有办法使用Outlook.Application和/或Outlook.MailItem和VBA获取详细信息?
这是显示收件人部门的功能:
$IMG is [bluehubs/bluehubs:9e8c3566e19cc86fb74b246dee86421a3f6d32bc]
$LATEST is [bluehubs/bluehubs:latest]
make: *** No rule to make target '9e8c3566e19cc86fb74b246dee86421a3f6d32bc', needed by 'build'. Stop.
但是我没有得到:
1)公司名称,例如副董事,副总裁...等。
2)组织详细信息,例如“客户服务”,“人力资源” ...等。
答案 0 :(得分:0)
此函数使用AddressEntry.GetExchangeUser方法(Outlook)获取所需的JobTitle /部门。
Public Function Get_JobTitle(ByVal Recipient As String)
Dim obApp As Object
Dim NewMail As MailItem
Set obApp = Outlook.Application
Set NewMail = obApp.CreateItem(olMailItem)
With NewMail
.Subject = Date & " Test Email"
.To = Recipient
End With
Get_JobTitle = NewMail.Recipients.Item(1).AddressEntry.GetExchangeUser.JobTitle
' Can replace JobTitle by department
NewMail.Delete
Set obApp = Nothing
Set NewMail = Nothing
End Function