This Visual Basic for Applications example uses the ResolveAll method to attempt to resolve all recipients and, if unsuccessful, displays a message box for each unresolved recipient.
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
If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using 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