ResolveAll Method

Microsoft Outlook Visual Basic

Attempts to resolve all the Recipient objects in the Recipients collection against the Address Book. Returns True if all of the objects were resolved, False if one or more were not.

expression.ResolveAll

expression    Required. An expression that returns a Recipients collection.

Remarks

When you run a program that uses the Microsoft Outlook object model to call the ResolveAll method, you receive a warning message. This warning message tells you that a program is trying to access the Address Book on your behalf and asks if you want to allow this.

Example

This Visual Basic for Applications (VBA) example uses the ResolveAll method to attempt to resolve all recipients and, if unsuccessful, displays a message box for each unresolved recipient.

Sub CheckRecipients()
 Dim myOlApp As New Outlook.Application
 Dim MyItem As Outlook.MailItem
 Dim myRecipients As Outlook.Recipients
 Dim myRecipient As Outlook.Recipient 
 Set myOlApp = CreateObject("Outlook.Application")
 Set myItem = myOlApp.CreateItem(olMailItem)
 Set myRecipients = myItem.Recipients
 myRecipients.Add("Aaron Con")
 myRecipients.Add("Nate Sun")
 myRecipients.Add("Dan Wilson")
 If Not myRecipients.ResolveAll Then
    For Each myRecipient In myRecipients
        If Not myRecipient.Resolved Then
            MsgBox myRecipient.Name
        End If
     Next
 End If
End Sub
		

If you use Microsoft Visual Basic Scripting Edition (VBScript) within an Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code in a CommandButton Click event.

Sub CommandButton1_Click()
 Set myItem = Application.CreateItem(0)
 Set myRecipients = myItem.Recipients
 myRecipients.Add("Aaron Con")
 myRecipients.Add("Nate Sun")
 myRecipients.Add("Dan Wilson")
 If Not myRecipients.ResolveAll Then
    For Each myRecipient In myRecipients
        If Not myRecipient.Resolved Then
            MsgBox myRecipient.Name
        End If
     Next
 End If
End Sub