返回收件人的电子邮件地址 [英] Return email address of recipient

查看:90
本文介绍了返回收件人的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个宏,当我进入电子邮件正文检查收件人的电子邮件地址时,该宏将自动运行.

I'm building a macro that will run automatically when I move into the body of an email to check the email address of the recipient.

我无法获取要加载到变量中的收件人地址.

I cannot get the address of the recipient to load into a variable.

Sub BuildTable()
Dim myItem As Outlook.MailItem
Dim myRecipient As String
Set myItem = Application.CreateItem(olMailItem)
Set myRecipient = myItem.Recipient.Address
....

推荐答案

您似乎在 MS Outlook 和 Active Inspector 中运行,因此可能:

It seems that you are running in MS Outlook and in an Active Inspector, so perhaps:

Sub CheckAddresses()
Dim oEmail As Outlook.MailItem
Dim r As Recipient
Dim rList As Recipients

Set oEmail = Application.ActiveInspector.CurrentItem

Set rList = oEmail.Recipients
rList.ResolveAll
For Each r In rList
    Debug.Print r.Address
Next
End Sub

这篇关于返回收件人的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆