尝试参照“通讯簿”解析 Recipients 集合内的所有 Recipient 对象。如果解析了所有对象,则返回 True;如果未全部解析,则返回 False。
expression.ResolveAll
expression 必选。该表达式返回 Recipients 集合。
本 Visual Basic for Applications 示例使用 ResolveAll 方法解析所有收件人。如果不成功,则为每个未解析的收件人显示一个消息框。
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myItem.Recipients
myRecipients.Add("Aaron Con")
myRecipients.Add("Viki Parrott")
myRecipients.Add("Jeffrey Weems")
If Not myRecipients.ResolveAll Then
For Each myRecipient In myRecipients
If Not myRecipient.Resolved Then
MsgBox myRecipient.Name
End If
Next
End If
如果使用 VBScript,则不创建 Application 对象,而且也不能使用命名常量。本示例说明如何使用 VBScript 执行相同任务。
Set myItem = Application.CreateItem(0)
Set myRecipients = myItem.Recipients
myRecipients.Add("Aaron Con")
myRecipients.Add("Viki Parrott")
myRecipients.Add("Jeffrey Weems")
If Not myRecipients.ResolveAll Then
For Each myRecipient In myRecipients
If Not myRecipient.Resolved Then
MsgBox myRecipient.Name
End If
Next
End If