<p>使用<code>Namespace</code>类的<a href="https://docs.microsoft.com/en-us/office/vba/api/outlook.namespace.createrecipient" rel="nofollow noreferrer">CreateRecipient</a>方法根据电子邮件地址获取收件人类的实例</p>
<pre><code>Sub TestRecipient()
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Set myNamespace = Application.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient("address@domain.com")
myRecipient.Resolve
If myRecipient.Resolved Then
' do some stuff here
End If
End Sub
</code></pre>
<p><a href="https://docs.microsoft.com/en-us/office/vba/api/outlook.recipient.addressentry" rel="nofollow noreferrer">Recipient.AddressEntry</a>属性返回与解析的收件人对应的<code>AddressEntry</code>对象。访问<code>AddressEntry</code>属性将强制解析未解析的收件人名称。如果无法解析名称,则返回错误。如果收件人已解析,<code>Resolved</code>属性为<code>True</code></p>
<p>然后,您可以使用<a href="https://docs.microsoft.com/en-us/office/vba/api/outlook.addressentry.getexchangeuser" rel="nofollow noreferrer">AddressEntry.GetExchangeUser</a>方法,如果<code>AddressEntry</code>属于诸如全局地址列表(GAL)之类的交换<code>AddressList</code>对象并与交换用户相对应,则该方法将返回表示<code>AddressEntry</code>的ExchangeUser对象</p>